diff --git a/server/.cargo/config.toml b/server/.cargo/config.toml index 62c59ce..7f3b9ce 100644 --- a/server/.cargo/config.toml +++ b/server/.cargo/config.toml @@ -17,31 +17,7 @@ TS_RS_EXPORT_DIR = { value = "../client/src/rust-types", relative = true } # TypeScript's convention. TS_RS_IMPORT_EXTENSION = "ts" -# Code coverage, the manual way: -# -# 1. Run `cargo install rustfilt` per the -# [code coverage docs](https://doc.rust-lang.org/rustc/instrument-coverage.html#building-the-demangler). -# 2. You must manually run `rustup component add llvm-tools-preview` following -# the -# [coverge docs](https://doc.rust-lang.org/rustc/instrument-coverage.html#installing-llvm-coverage-tools). -# Per some searching, also run `cargo install cargo-binutils` to put these -# tools in the path. -# 3. In Powershell, `$Env:RUSTFLAGS = "-C instrument-coverage"` then `cargo -# test`. When the tests run, record the name of the test binary. -# 4. `rust-profdata merge -sparse default_*.profraw -o default.profdata`. -# 5. `rust-cov show --Xdemangler=rustfilt -# target\debug\deps\code_chat_editor-4dbe5c7815a53cd9.exe -# --instr-profile=default.profdata --ignore-filename-regex=\\.cargo\\registry -# --format=html --output-dir=coverage`, replacing the binary path with the -# one recorded in step 3. -# 6. Open the file `coverage\index.html`. -# -# Or, `cargo install cargo-tarpaulin` then `cargo tarpaulin --ignore-panics -# --out=html --skip-clean`. [build] -# Set these to match the output from `cargo tarpaulin --print-rust-flags` to -# avoid recompiles. -# -# This is commented out; for development, uncomment this. -##rustflags = ["-Cdebuginfo=2", "-Cstrip=none", "--cfg=tarpaulin", "-Cinstrument-coverage"] +# To check coverage, `cargo install cargo-tarpaulin` then `cargo tarpaulin +# --skip-clean --out=html --target-dir=tarpaulin`. \ No newline at end of file diff --git a/server/.gitignore b/server/.gitignore index 52b06b8..c935c38 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -23,14 +23,12 @@ target/ # Output from profiling. +tarpaulin/ *.profraw tarpaulin-report.html -# Copied files needed to `cargo publish`. -static/ +# Other files. hashLocations.json - -config.json *.log -.windows/ + # CodeChat Editor lexer: python. See TODO. diff --git a/server/tests/overall_2.rs b/server/tests/overall_2.rs index 70a3d52..54a07d7 100644 --- a/server/tests/overall_2.rs +++ b/server/tests/overall_2.rs @@ -374,7 +374,7 @@ async fn test_6_core( // Perform edits. body_content.send_keys("a").await.unwrap(); - let client_id = INITIAL_CLIENT_MESSAGE_ID; + let mut client_id = INITIAL_CLIENT_MESSAGE_ID; let msg = codechat_server.get_message_timeout(TIMEOUT).await.unwrap(); let client_version = get_version(&msg); assert_eq!( @@ -406,6 +406,24 @@ async fn test_6_core( ); let version = client_version; codechat_server.send_result(client_id, None).await.unwrap(); + client_id += MESSAGE_ID_INCREMENT; + + // Wait for a second update that's empty. Not sure why. + assert_eq!( + codechat_server.get_message_timeout(TIMEOUT).await.unwrap(), + EditorMessage { + id: client_id, + message: EditorMessageContents::Update(UpdateMessageContents { + file_path: path_str.clone(), + cursor_position: None, + includes_marker: false, + scroll_position: None, + is_re_translation: false, + contents: None, + }) + } + ); + codechat_server.send_result(client_id, None).await.unwrap(); //client_id += MESSAGE_ID_INCREMENT; // Send new text, which turns into a diff. diff --git a/server/tests/overall_common/mod.rs b/server/tests/overall_common/mod.rs index 894a4e4..287a03d 100644 --- a/server/tests/overall_common/mod.rs +++ b/server/tests/overall_common/mod.rs @@ -310,6 +310,7 @@ pub async fn goto_line( && update.contents.is_none() && update.cursor_position != Some(line) { + codechat_server.send_result(*client_id, None).await.unwrap(); *client_id += MESSAGE_ID_INCREMENT; msg = codechat_server.get_message_timeout(TIMEOUT).await.unwrap(); }