Skip to content

Commit bb39955

Browse files
committed
Rust: Move the undefined_macros test cases to their own subdirectory.
1 parent aa35e82 commit bb39955

File tree

6 files changed

+37
-30
lines changed

6 files changed

+37
-30
lines changed

rust/ql/test/query-tests/unusedentities/UnusedValue.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
| main.rs:284:13:284:17 | total | Variable $@ is assigned a value that is never used. | main.rs:252:13:252:17 | total | total |
1515
| main.rs:377:9:377:9 | x | Variable $@ is assigned a value that is never used. | main.rs:377:9:377:9 | x | x |
1616
| main.rs:385:17:385:17 | x | Variable $@ is assigned a value that is never used. | main.rs:385:17:385:17 | x | x |
17-
| main.rs:556:9:556:20 | var_in_macro | Variable $@ is assigned a value that is never used. | main.rs:556:9:556:20 | var_in_macro | var_in_macro |
18-
| main.rs:565:9:565:9 | c | Variable $@ is assigned a value that is never used. | main.rs:565:9:565:9 | c | c |
17+
| main.rs:531:9:531:20 | var_in_macro | Variable $@ is assigned a value that is never used. | main.rs:531:9:531:20 | var_in_macro | var_in_macro |
18+
| main.rs:540:9:540:9 | c | Variable $@ is assigned a value that is never used. | main.rs:540:9:540:9 | c | c |
1919
| more.rs:44:9:44:14 | a_ptr4 | Variable $@ is assigned a value that is never used. | more.rs:44:9:44:14 | a_ptr4 | a_ptr4 |
2020
| more.rs:59:9:59:13 | d_ptr | Variable $@ is assigned a value that is never used. | more.rs:59:9:59:13 | d_ptr | d_ptr |
2121
| more.rs:65:13:65:17 | f_ptr | Variable $@ is assigned a value that is never used. | more.rs:65:13:65:17 | f_ptr | f_ptr |

rust/ql/test/query-tests/unusedentities/main.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -507,31 +507,6 @@ fn macros2() {
507507
}
508508

509509
fn macros3() {
510-
let d: u16 = 4;
511-
512-
undefined_macro_call!(d);
513-
}
514-
515-
fn macros4() {
516-
{
517-
let a: u16 = 6; // $ MISSING: Alert[rust/unused-variable]
518-
}
519-
520-
undefined_macro_call!(5);
521-
522-
let b: u16 = 6; // $ MISSING: Alert[rust/unused-variable]
523-
}
524-
525-
fn macros5() {
526-
match std::env::args().nth(1).unwrap().parse::<u16>() {
527-
Ok(n) => {
528-
undefined_macro_call!(n);
529-
}
530-
_ => {}
531-
}
532-
}
533-
534-
fn macros6() {
535510
let x;
536511
println!(
537512
"The value of x is {}",
@@ -601,9 +576,6 @@ fn main() {
601576
macros1();
602577
macros2();
603578
macros3();
604-
macros4();
605-
macros5();
606-
macros6();
607579
hygiene_mismatch();
608580
references();
609581

rust/ql/test/query-tests/unusedentities/undefined_macros/UnusedVariable.expected

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
query: queries/unusedentities/UnusedVariable.ql
2+
postprocess: utils/test/InlineExpectationsTestQuery.ql
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
// --- undefined macro calls ---
3+
4+
fn undefined_macros1() {
5+
let d: u16 = 4;
6+
7+
undefined_macro_call!(d);
8+
}
9+
10+
fn undefined_macros2() {
11+
{
12+
let a: u16 = 6; // $ MISSING: Alert[rust/unused-variable]
13+
}
14+
15+
undefined_macro_call!(5);
16+
17+
let b: u16 = 6; // $ MISSING: Alert[rust/unused-variable]
18+
}
19+
20+
fn undefined_macros3() {
21+
match std::env::args().nth(1).unwrap().parse::<u16>() {
22+
Ok(n) => {
23+
undefined_macro_call!(n);
24+
}
25+
_ => {}
26+
}
27+
}
28+
29+
fn main() {
30+
undefined_macros1();
31+
undefined_macros2();
32+
undefined_macros3();
33+
}

0 commit comments

Comments
 (0)