Skip to content

Commit a40cfeb

Browse files
committed
Rust: Add test for model returning a future
1 parent d7117ef commit a40cfeb

File tree

4 files changed

+152
-137
lines changed

4 files changed

+152
-137
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,16 @@ fn test_apply_flow_through() {
203203
sink(t); // $ hasValueFlow=33
204204
}
205205

206+
async fn get_async_number(a: i64) -> i64 {
207+
37
208+
}
209+
210+
async fn test_get_async_number() {
211+
let s = source(46);
212+
let t = get_async_number(s).await;
213+
sink(t); // $ MISSING: hasValueFlow=46
214+
}
215+
206216
impl MyFieldEnum {
207217
// has a source model
208218
fn source(&self, i: i64) -> MyFieldEnum {
@@ -268,7 +278,8 @@ fn test_simple_sink() {
268278
simple_sink(s); // $ hasValueFlow=17
269279
}
270280

271-
fn main() {
281+
#[tokio::main]
282+
async fn main() {
272283
test_identify();
273284
test_get_var_pos();
274285
test_set_var_pos();
@@ -286,5 +297,6 @@ fn main() {
286297
test_enum_method_sink();
287298
test_simple_source();
288299
test_simple_sink();
300+
test_get_async_number().await;
289301
let dummy = Some(0); // ensure that the the `lang:core` crate is extracted
290302
}

0 commit comments

Comments
 (0)