diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-07-25 21:25:09 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-07-26 12:14:59 +0300 |
| commit | a463dc7d6c3bb560903d11cb9e34668e89c374d6 (patch) | |
| tree | 70fa3aee76ed184ad30de65959aa39583cea4316 /test/cases/compile_errors/invalid_identifiers.zig | |
| parent | 2f54129087859fbd9a437d0cee33f16df523dd0b (diff) | |
| download | zig-a463dc7d6c3bb560903d11cb9e34668e89c374d6.tar.gz zig-a463dc7d6c3bb560903d11cb9e34668e89c374d6.zip | |
AstGen: disable null bytes and empty stings in some places
Namely:
* test names
* identifiers
* library names
* import strings
Diffstat (limited to 'test/cases/compile_errors/invalid_identifiers.zig')
| -rw-r--r-- | test/cases/compile_errors/invalid_identifiers.zig | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/cases/compile_errors/invalid_identifiers.zig b/test/cases/compile_errors/invalid_identifiers.zig new file mode 100644 index 0000000000..bf1244b547 --- /dev/null +++ b/test/cases/compile_errors/invalid_identifiers.zig @@ -0,0 +1,33 @@ +extern "" var a: u32; +extern "" fn b() void; + +extern "\x00" var c: u32; +extern "\x00" fn d() void; + +test "" {} +test "\x00" {} + +const e = @import(""); +const f = @import("\x00"); + +comptime { + const @"" = undefined; +} +comptime { + const @"\x00" = undefined; +} + +// error +// backend=stage2 +// target=native +// +// :1:8: error: library name cannot be empty +// :2:8: error: library name cannot be empty +// :4:8: error: library name cannot contain null bytes +// :5:8: error: library name cannot contain null bytes +// :7:6: error: empty test name must be omitted +// :8:6: error: test name cannot contain null bytes +// :10:19: error: import path cannot be empty +// :11:19: error: import path cannot contain null bytes +// :14:11: error: identifier cannot be empty +// :17:11: error: identifier cannot contain null bytes |
