Akuli / jou

Yet another programming language
MIT License
11 stars 4 forks source link

test won't run when source contains a zero byte #438

Closed littlewhitecloud closed 7 months ago

littlewhitecloud commented 7 months ago

import "stdlib/io.jou"

def main() -> int:
    printf('?)  # Error: missing ' to end the byte literal
    return 0
Akuli commented 7 months ago

You could use a # Output: comment. This test works:

import "stdlib/io.jou"

# Output: compiler error in file "tests/other_errors/asdasd.jou", line 5: missing ' to end the byte literal
def main() -> int:
    printf('?)
    return 0
littlewhitecloud commented 7 months ago

thanks!

littlewhitecloud commented 7 months ago

Test like this: image And output:

*** Command: jou -O3 tests/other_errors/source_file_contain_zero_byte.jou ***

--- /dev/fd/63  2023-12-16 06:07:20.807290345 +0000
+++ /dev/fd/62  2023-12-16 06:07:20.807290345 +0000
@@ -1 +1,2 @@
+compiler error in file "tests/other_errors/source_file_contain_zero_byte.jou", line 6: source file contains a zero byte