about summary refs log tree commit diff
path: root/lang/zig/blocks.zig
blob: 5f6f0e839c8692314a1182b3da0165755704f0a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const expect = @import("std").testing.expect;

test "labeled break from labeled block expression" {
    var y: i32 = 123;

    const x = blk: {
        y += 1;
        break :blk y;
    };
    expect(x == y);
    expect(y == 124);
}

test "access variable after block scope" {
    { var x: i32 = 1; }
    // undeclared
    // x += 1;
}