Carp/test/regression.carp
2019-05-10 11:21:46 +02:00

34 lines
861 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(local-include "../test/fixture_foo.h")
(load "Test.carp")
(load "Vector.carp")
; this is a test-only module to test module resolution (see #288)
(defmodule Foo
(register init (Fn [] Int) "fooInit")
)
(use-all Test Vector2 Foo)
(deftest test
(assert-equal test
1
(init)
"test that the right module gets resolved"
)
(assert-equal test
\\
(String.char-at "\\" 0)
"test that strings get escaped correctly"
)
(assert-equal test
Int.MAX
@&Int.MAX
"test that the address of Int.MAX can be taken"
)
(assert-equal test
&(Result.Error @"File “foobar” couldnt be opened!")
&(IO.read->EOF "foobar")
"test that reading from an undefined file works"
)
)