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

test "string literals" {
    const bytes = "hello";
    expect(@TypeOf(bytes) == *const [5:0]u8);
    expect(bytes.len == 5);
    expect(bytes[1] == 'e');
    expect(bytes[5] == 0);
    expect('e' == '\x65');
    expect('\u{1f4a9}' == 128169);
    expect('💯' == 128175);
    expect(mem.eql(u8, "hello", "h\x65llo"));
}