check_ints_equal now prints a newline after the failure message on failure.

We still don't know how to print a final newline after all the tests have
run, for the common case when all tests pass.

Ideally I could just emit a few instructions to `run_tests`. But I'd also
need to add a variable for the newline to the data segment. Or I need some
literal syntax for newlines in strings. We don't have support for backslash-escapes
yet.
This commit is contained in:
Kartik Agaram 2018-09-23 12:07:55 -07:00
parent d48cfd0f36
commit bf86f7f39d
2 changed files with 13 additions and 0 deletions

Binary file not shown.

View File

@ -130,6 +130,13 @@ $check_ints_equal:else:
# call
e8/call write_stderr/disp32
# discard arg
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add 4 to ESP
# print newline
# push args
68/push Newline/imm32
# call
e8/call write_stderr/disp32
# discard arg
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add 4 to ESP
# end
c3/return
@ -196,6 +203,12 @@ write_stderr: # s : (address array byte) -> <void>
c3/return
== data
Newline:
# size
01 00 00 00
# data
0a/newline
Test_argv: # null-terminated
# data
74/t 65/e 73/s 74/t 00/null