File tree Expand file tree Collapse file tree 4 files changed +258
-165
lines changed
library-tests/dataflow/models
utils-tests/modelgenerator Expand file tree Collapse file tree 4 files changed +258
-165
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,34 @@ fn test_set_tuple_element() {
175175 sink ( t. 1 ) ; // $ hasValueFlow=11
176176}
177177
178+ // has a flow model
179+ pub fn apply < F > ( n : i64 , f : F ) -> i64 where F : FnOnce ( i64 ) -> i64 {
180+ 0
181+ }
182+
183+ fn test_apply_flow_in ( ) {
184+ let s = source ( 83 ) ;
185+ let f = |n| {
186+ sink ( n) ; // $ hasValueFlow=83
187+ n + 3
188+ } ;
189+ apply ( s, f) ;
190+ }
191+
192+ fn test_apply_flow_out ( ) {
193+ let s = source ( 86 ) ;
194+ let f = |n| if n != 0 { n } else { s } ;
195+ let t = apply ( 34 , f) ;
196+ sink ( t) ; // $ MISSING: hasValueFlow=86
197+ }
198+
199+ fn test_apply_flow_through ( ) {
200+ let s = source ( 33 ) ;
201+ let f = |n| if n != 0 { n } else { 0 } ;
202+ let t = apply ( s, f) ;
203+ sink ( t) ; // $ hasValueFlow=33
204+ }
205+
178206impl MyFieldEnum {
179207 // has a source model
180208 fn source ( & self , i : i64 ) -> MyFieldEnum {
You can’t perform that action at this time.
0 commit comments