Skip to content

Commit

Permalink
Add test for D51635478 and bump version
Browse files Browse the repository at this point in the history
Summary: Diff came from open-source without a test so here's a test.

Reviewed By: evanworley, zertosh

Differential Revision: D51682707

fbshipit-source-id: 137dd7e5fd36a7dfb50c6dd14857e8fd9bff5658
  • Loading branch information
swolchok authored and facebook-github-bot committed Nov 30, 2023
1 parent 8070231 commit 98c0429
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fastmod"
version = "0.4.3"
version = "0.4.4"
authors = ["Scott Wolchok <[email protected]>"]
description = "Fast, partial replacement for codemod (find/replace tool for programmers)"
edition = "2018"
Expand Down
21 changes: 21 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1173,4 +1173,25 @@ mod tests {
.assert()
.success();
}

#[test]
fn test_dollar_sign_in_replacement_string_with_fixed_strings() {
let contents = "something";
let dir = create_test_files(&[("foo.txt", contents)]);
Command::cargo_bin("fastmod")
.unwrap()
.args(&[
"-F",
"something",
"$foo.bar",
"--dir",
dir.path().to_str().unwrap(),
])
.write_stdin("y\n")
.assert()
.success();
let file_path = dir.path().join("foo.txt");
let new_contents = read_to_string(file_path).unwrap();
assert_eq!(new_contents, "$foo.bar");
}
}

0 comments on commit 98c0429

Please sign in to comment.