-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require "./spec_helper" | ||
|
||
describe Luajit do | ||
describe "global nil" do | ||
it ".setup_global_nil" do | ||
Luajit.run do |state| | ||
Luajit.setup_global_nil(state) | ||
|
||
state.execute(<<-'LUA').ok?.should be_true | ||
local x = NIL | ||
assert(type(x) == 'userdata') | ||
assert(x ~= nil) | ||
assert(tostring(x) == 'NIL') | ||
LUA | ||
end | ||
end | ||
|
||
it ".is_global_nil?" do | ||
Luajit.run do |state| | ||
Luajit.setup_global_nil(state) | ||
|
||
state.execute(<<-'LUA').ok?.should be_true | ||
return NIL | ||
LUA | ||
Luajit.is_global_nil?(state, -1).should be_true | ||
|
||
state.execute(<<-'LUA').ok?.should be_true | ||
return nil | ||
LUA | ||
Luajit.is_global_nil?(state, -1).should be_false | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters