Skip to content

Commit 062db00

Browse files
committed
test: Reproduce js panic
This reproduces the problem in #71
1 parent e6b045d commit 062db00

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/cli.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,43 @@ HEAD 1 │ test('arg1');
3535

3636
root.close().unwrap();
3737
}
38+
39+
#[test]
40+
fn js_highlight_panics() {
41+
let root = snapbox::path::PathFixture::mutable_temp().unwrap();
42+
let root_path = root.path().unwrap();
43+
let plan = git_fixture::TodoList {
44+
commands: vec![
45+
git_fixture::Command::Tree(git_fixture::Tree {
46+
files: [("basic.js", "test('arg1');")]
47+
.into_iter()
48+
.map(|(p, c)| (p.into(), c.into()))
49+
.collect::<std::collections::HashMap<_, _>>(),
50+
message: Some("A".to_owned()),
51+
author: None,
52+
}),
53+
git_fixture::Command::Branch("main".into()),
54+
],
55+
..Default::default()
56+
};
57+
plan.run(root_path).unwrap();
58+
59+
snapbox::cmd::Command::new(snapbox::cmd::cargo_bin!("git-dive"))
60+
.arg("basic.js")
61+
.current_dir(root_path)
62+
.env("CLICOLOR_FORCE", "1")
63+
.assert()
64+
.failure()
65+
.stdout_eq(
66+
"\
67+
",
68+
)
69+
.stderr_matches(
70+
"\
71+
thread 'main' panicked at 'regex string should be pre-tested: [..]
72+
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
73+
",
74+
);
75+
76+
root.close().unwrap();
77+
}

0 commit comments

Comments
 (0)