diff --git a/tests/testthat/_snaps/scan-dependencies.md b/tests/testthat/_snaps/scan-dependencies.md index 5d8679b2..30892d7b 100644 --- a/tests/testthat/_snaps/scan-dependencies.md +++ b/tests/testthat/_snaps/scan-dependencies.md @@ -426,3 +426,23 @@ 2 2 a "(call)\n" 1 3 3 b "(call)\n" 1 +# syntax error is handled + + Code + code_query("f(1); g(1,2); 1+; h(3)", "(call) @call-code") + Output + $patterns + # A data frame: 1 x 4 + id name pattern match_count + + 1 1 "(call) @call-code\n" 3 + + $matched_captures + # A data frame: 3 x 8 + id pattern match start_byte start_row start_column name code + + 1 1 1 1 1 1 1 call-code f(1) + 2 1 1 2 7 1 7 call-code g(1,2) + 3 1 1 3 19 1 19 call-code h(3) + + diff --git a/tests/testthat/test-scan-dependencies.R b/tests/testthat/test-scan-dependencies.R index a7e4648b..b6979660 100644 --- a/tests/testthat/test-scan-dependencies.R +++ b/tests/testthat/test-scan-dependencies.R @@ -191,3 +191,9 @@ test_that("pattern names", { code_query("f('x')", c(a = "(call) (call)", b = "(call)"))[["patterns"]] }) }) + +test_that("syntax error is handled", { + expect_snapshot({ + code_query("f(1); g(1,2); 1+; h(3)", "(call) @call-code") + }) +}) \ No newline at end of file