mirror of
https://github.com/carp-lang/Carp.git
synced 2024-11-05 04:44:12 +03:00
34 lines
861 B
Plaintext
34 lines
861 B
Plaintext
(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” couldn’t be opened!")
|
||
&(IO.read->EOF "foobar")
|
||
"test that reading from an undefined file works"
|
||
)
|
||
)
|