Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
lib_spec.cr 1.45 KiB
Newer Older
  pending "codegens lib var set and get" do
      lib LibC
      LibC.errno = 1
      LibC.errno
      lib LibC
        LibC.srandom(0_u32)
  it "allows passing type to LibC if it has a coverter with to_unsafe" do
      lib LibC
      LibC.foo Foo.new
  it "allows passing type to LibC if it has a coverter with to_unsafe (bug)" do
      lib LibC
      LibC.foo(foo &.to_s)

  it "allows setting/getting external variable as function pointer" do
    build(%(
      require "prelude"

      lib LibC
      LibC.x = ->{}
      LibC.x.call

  it "can use enum as fun argument" do
    build(%(
      enum Foo
        A
      end

      lib LibC
      LibC.foo(Foo::A)
      ))
  end

  it "can use enum as fun return" do
    build(%(
      enum Foo
        A
      end

      lib LibC
      LibC.foo