From 73abb9bef033a1c74d93393b918ba44dcad626ea Mon Sep 17 00:00:00 2001 From: Hidetatz Yaginuma Date: Sun, 30 Jul 2023 09:03:52 +0900 Subject: [PATCH] fix to use exit() in tests --- std/testing.sb | 5 ----- stdmod.go | 1 - tests/arith.sb | 8 ++++---- tests/binary.sb | 8 ++++---- 4 files changed, 8 insertions(+), 14 deletions(-) delete mode 100644 std/testing.sb diff --git a/std/testing.sb b/std/testing.sb deleted file mode 100644 index 6c98489..0000000 --- a/std/testing.sb +++ /dev/null @@ -1,5 +0,0 @@ -def assert(expected, actual) { - if expected != actual { - print("test failed. expected: ", expected, ", actual: " , actual) - } -} diff --git a/stdmod.go b/stdmod.go index 17a24b3..2237b95 100644 --- a/stdmod.go +++ b/stdmod.go @@ -2,7 +2,6 @@ package main var stdmods = []string{ "os", - "testing", } func isstdmod(target string) bool { diff --git a/tests/arith.sb b/tests/arith.sb index 3819e83..8dc7688 100644 --- a/tests/arith.sb +++ b/tests/arith.sb @@ -1,8 +1,6 @@ -import testing +import assert -as = testing.assert - -print("running arith test") +as = assert.assert as(6, 4 + 2) as(2, 4 - 2) @@ -22,3 +20,5 @@ as(1.0, 0.1 * 10) as(1.0, 0.1 * 10.0) as(3, (1+2) * (3-2)) as(19, (1*2) + ((3-2) * 12 +(1*5))) + +print("arith test succeeded") diff --git a/tests/binary.sb b/tests/binary.sb index 9b15f84..c657125 100644 --- a/tests/binary.sb +++ b/tests/binary.sb @@ -1,8 +1,6 @@ -import testing +import assert -as = testing.assert - -print("running binary test") +as = assert.assert as(false, 4 == 2) as(false, 4 == 4.0) @@ -29,3 +27,5 @@ as(0, 1 & 6) as(7, 1 ^ 6) as(24, 3 << 3) as(1, 3 >> 1) + +print("binary test succeeded")