Newer
Older
Ary Borenszweig
committed
require "../../spec_helper"
describe "Code gen: lib" do
pending "codegens lib var set and get" do
Ary Borenszweig
committed
run("
Ary Borenszweig
committed
$errno : Int32
end
Ary Borenszweig
committed
").to_i.should eq(1)
end
it "call to void function" do
run("
Ary Borenszweig
committed
fun srandom(x : UInt32) : Void
end
def foo
Ary Borenszweig
committed
end
foo
")
end
it "allows passing type to LibC if it has a coverter with to_unsafe" do
build("
Ary Borenszweig
committed
fun foo(x : Int32) : Int32
Ary Borenszweig
committed
class Foo
def to_unsafe
1
end
end
")
end
it "allows passing type to LibC if it has a coverter with to_unsafe (bug)" do
Ary Borenszweig
committed
build(%(
require "prelude"
Ary Borenszweig
committed
fun foo(x : UInt8*)
Ary Borenszweig
committed
def foo
yield 1
Ary Borenszweig
committed
))
it "allows setting/getting external variable as function pointer" do
build(%(
require "prelude"
$x : ->
end
it "can use enum as fun argument" do
build(%(
enum Foo
A
end
fun foo(x : Foo)
end
))
end
it "can use enum as fun return" do
build(%(
enum Foo
A
end
fun foo : Foo
end