Skip to content

Commit cf1b19f

Browse files
committed
Rust: Add test for MaD argument source
1 parent 7208604 commit cf1b19f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

rust/ql/test/library-tests/dataflow/models/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,15 @@ fn test_simple_sink() {
279279
simple_sink(s); // $ hasValueFlow=17
280280
}
281281

282+
// has a source model
283+
fn arg_source(i: i64) {}
284+
285+
fn test_arg_source() {
286+
let i = 19;
287+
arg_source(i);
288+
sink(i) // $ MISSING: hasValueFlow=i
289+
}
290+
282291
#[tokio::main]
283292
async fn main() {
284293
test_identify();
@@ -299,5 +308,6 @@ async fn main() {
299308
test_simple_source();
300309
test_simple_sink();
301310
test_get_async_number().await;
311+
test_arg_source();
302312
let dummy = Some(0); // ensure that the the `lang:core` crate is extracted
303313
}

rust/ql/test/library-tests/dataflow/models/models.ext.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ extensions:
66
- ["repo::test", "crate::simple_source", "ReturnValue", "test-source", "manual"]
77
- ["repo::test", "crate::enum_source", "ReturnValue.Field[crate::MyFieldEnum::D::field_d]", "test-source", "manual"]
88
- ["repo::test", "<crate::MyFieldEnum>::source", "ReturnValue.Field[crate::MyFieldEnum::C::field_c]", "test-source", "manual"]
9+
- ["repo::test", "crate::arg_source", "Argument[0]", "test-source", "manual"]
910
- addsTo:
1011
pack: codeql/rust-all
1112
extensible: sinkModel

0 commit comments

Comments
 (0)