| ... | @@ -5246,11 +5246,15 @@ test "fn type inference" { | ... | @@ -5246,11 +5246,15 @@ test "fn type inference" { |
| 5246 | {#header_close#} | 5246 | {#header_close#} |
| 5247 | {#header_open|Function Reflection#} | 5247 | {#header_open|Function Reflection#} |
| 5248 | {#code_begin|test|test_fn_reflection#} | 5248 | {#code_begin|test|test_fn_reflection#} |
| 5249 | const expect = @import("std").testing.expect; | 5249 | const std = @import("std"); |
| | 5250 | const math = std.math; |
| | 5251 | const testing = std.testing; |
| 5250 | | 5252 | |
| 5251 | test "fn reflection" { | 5253 | test "fn reflection" { |
| 5252 | try expect(@typeInfo(@TypeOf(expect)).Fn.args[0].arg_type.? == bool); | 5254 | try testing.expect(@typeInfo(@TypeOf(testing.expect)).Fn.args[0].arg_type.? == bool); |
| 5253 | try expect(@typeInfo(@TypeOf(expect)).Fn.is_var_args == false); | 5255 | try testing.expect(@typeInfo(@TypeOf(testing.tmpDir)).Fn.return_type.? == testing.TmpDir); |
| | 5256 | |
| | 5257 | try testing.expect(@typeInfo(@TypeOf(math.Log2Int)).Fn.is_generic); |
| 5254 | } | 5258 | } |
| 5255 | {#code_end#} | 5259 | {#code_end#} |
| 5256 | {#header_close#} | 5260 | {#header_close#} |