Skip to content

Commit

Permalink
chore: get rid of github_issue_test file
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Feb 21, 2024
1 parent 55cd985 commit 55101ed
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 42 deletions.
42 changes: 0 additions & 42 deletions cli/src/tests/github_issue_test.rs

This file was deleted.

32 changes: 32 additions & 0 deletions cli/src/tests/query_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5072,3 +5072,35 @@ fn test_grammar_with_aliased_literal_query() {

assert!(query.is_ok());
}

#[test]
fn test_query_with_first_child_in_group_is_anchor() {
let language = get_language("c");
let source_code = r"void fun(int a, char b, int c) { };";
let query = r#"
(parameter_list
.
((parameter_declaration) @constant
(#match? @constant "^int")))"#;
let query = Query::new(&language, query).unwrap();
assert_query_matches(
&language,
&query,
source_code,
&[(0, vec![("constant", "int a")])],
);
}

// This test needs be executed with UBSAN enabled to check for regressions:
// ```
// UBSAN_OPTIONS="halt_on_error=1" \
// CFLAGS="-fsanitize=undefined" \
// RUSTFLAGS="-lubsan" \
// cargo test --target $(rustc -vV | sed -nr 's/^host: //p') -- --test-threads 1
// ```
#[test]
fn test_query_compiler_oob_access() {
let language = get_language("java");
// UBSAN should not report any OOB access
assert!(Query::new(&language, "(package_declaration _ (_) @name _)").is_ok());
}

0 comments on commit 55101ed

Please sign in to comment.