2018-08-02 18:55:31 +01:00
|
|
|
const std = @import("std");
|
2019-02-08 23:18:47 +00:00
|
|
|
const expect = std.testing.expect;
|
2018-08-02 18:55:31 +01:00
|
|
|
|
|
|
|
test "ignore lval with underscore" {
|
|
|
|
_ = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
test "ignore lval with underscore (for loop)" {
|
2019-06-10 00:24:24 +01:00
|
|
|
for ([_]void{}) |_, i| {
|
2021-06-20 02:10:22 +01:00
|
|
|
_ = i;
|
2019-06-10 00:24:24 +01:00
|
|
|
for ([_]void{}) |_, j| {
|
2021-06-20 02:10:22 +01:00
|
|
|
_ = j;
|
2018-08-02 18:55:31 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test "ignore lval with underscore (while loop)" {
|
|
|
|
while (optionalReturnError()) |_| {
|
2018-10-15 14:51:15 +01:00
|
|
|
while (optionalReturnError()) |_| {
|
|
|
|
break;
|
|
|
|
} else |_| {}
|
|
|
|
break;
|
|
|
|
} else |_| {}
|
2018-08-02 18:55:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fn optionalReturnError() !?u32 {
|
|
|
|
return error.optionalReturnError;
|
|
|
|
}
|