Skip to content

Commit

Permalink
Added test cases for Lua.eval() and Lua.eval!().
Browse files Browse the repository at this point in the history
  • Loading branch information
artob committed Aug 4, 2016
1 parent 92469a4 commit 1dd14fb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/lua_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,23 @@ defmodule LuaTest do
use ExUnit.Case, async: true

doctest Lua

test "Lua.eval/2" do
assert Lua.eval(Lua.State.new, "return 6 * 7") == {:ok, [42.0]}
assert Lua.eval(Lua.State.new, "foobar") == {:error,
{:badmatch, {:error, [{1, :luerl_parse, 'illegal call'}], []}}}
end

test "Lua.eval!/2" do
assert Lua.eval!(Lua.State.new, "return 6 * 7") == [42.0]
assert_raise Lua.Error, fn -> Lua.eval!(Lua.State.new, "foobar") end
end

test "Lua.eval_file/2" do
#Lua.eval_file(Lua.State.new, "etc/examples/hello.lua") # FIXME: shebang
end

test "Lua.eval_file!/2" do
#Lua.eval_file!(Lua.State.new, "etc/examples/hello.lua") # FIXME: shebang
end
end

0 comments on commit 1dd14fb

Please sign in to comment.