diff options
author | Tatsuyuki Ishi <ishitatsuyuki@google.com> | 2024-04-12 02:45:39 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-04-12 14:55:46 +0000 |
commit | dc3dc47e53e3030966505bb0f49980cf8236643a (patch) | |
tree | d235f904c25ff14c9995834992dad33312ad1d44 | |
parent | 48b9e2d0f85f99e56e2df07ecc2d4f9b360f5216 (diff) | |
download | toolchain-utils-dc3dc47e53e3030966505bb0f49980cf8236643a.tar.gz |
rust-analyzer-chromiumos-wrapper: Simplify test payloads
Use raw literals to avoid escape sequences.
Remove comments about parameter names, since the information is easily
available through IDEs (Inlay Hints) these days.
BUG=b:333979840
TEST=cargo test
Change-Id: I725f74142f760d8e41b8b766d9ef8272ec219cb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5446199
Auto-Submit: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Commit-Queue: George Burgess <gbiv@chromium.org>
Reviewed-by: Allen Webb <allenwebb@google.com>
Reviewed-by: George Burgess <gbiv@chromium.org>
Tested-by: Tatsuyuki Ishi <ishitatsuyuki@google.com>
-rw-r--r-- | rust-analyzer-chromiumos-wrapper/src/main.rs | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/rust-analyzer-chromiumos-wrapper/src/main.rs b/rust-analyzer-chromiumos-wrapper/src/main.rs index e293cdbf..09657b12 100644 --- a/rust-analyzer-chromiumos-wrapper/src/main.rs +++ b/rust-analyzer-chromiumos-wrapper/src/main.rs @@ -387,46 +387,60 @@ mod test { #[test] fn test_stream_with_replacement_1() -> Result<()> { test_stream_with_replacement( - // read - "{\"somekey\": {\"somepath\": \"XYZXYZabc\",\ - \"anotherpath\": \"somestring\"}, \"anotherkey\": \"XYZXYZdef\"}", - // pattern + r#"{ + "somekey": { + "somepath": "XYZXYZabc", + "anotherpath": "somestring" + }, + "anotherkey": "XYZXYZdef" + }"#, "XYZXYZ", - // replacement "REPLACE", - // json_expected - "{\"somekey\": {\"somepath\": \"REPLACEabc\", \"anotherpath\": \"somestring\"},\ - \"anotherkey\": \"REPLACEdef\"}", + r#"{ + "somekey": { + "somepath": "REPLACEabc", + "anotherpath": "somestring" + }, + "anotherkey": "REPLACEdef" + }"#, ) } #[test] fn test_stream_with_replacement_2() -> Result<()> { test_stream_with_replacement( - // read - "{\"key0\": \"sometextABCDEF\",\ - \"key1\": {\"key2\": 5, \"key3\": \"moreABCDEFtext\"}, \"key4\": 1}", - // pattern + r#"{ + "key0": "sometextABCDEF", + "key1": { + "key2": 5, + "key3": "moreABCDEFtext" + }, + "key4": 1 + }"#, "ABCDEF", - // replacement "replacement", - // json_expected - "{\"key0\": \"sometextreplacement\", \"key1\": {\"key2\": 5,\ - \"key3\": \"morereplacementtext\"}, \"key4\": 1}", + r#"{ + "key0": "sometextreplacement", + "key1": { + "key2": 5, + "key3": "morereplacementtext" + }, + "key4": 1 + }"#, ) } #[test] fn test_stream_with_replacement_3() -> Result<()> { test_stream_with_replacement( - // read - "{\"path\": \"/my_folder/rust-analyzer-chromiumos-wrapper\"}", - // pattern + r#"{ + "path": "/my_folder/rust-analyzer-chromiumos-wrapper" + }"#, "", - // replacement "", - // json_expected - "{\"path\": \"/usr/sbin/rust-analyzer\"}", + r#"{ + "path": "/usr/sbin/rust-analyzer" + }"#, ) } } |