-
-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/0-11-stable'
* origin/0-11-stable: Move the remaining JS API specs to corelib/runtime Move all Opal.exit specs under corelib/runtime Let bin/opal load bundler/setup Try to coerce Kernel#exit status to int Fix Kernel#exit check on numbers
- Loading branch information
Showing
6 changed files
with
68 additions
and
87 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
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
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,16 @@ | ||
module RuntimeFixtures | ||
class A | ||
end | ||
|
||
class A::B | ||
module C | ||
|
||
end | ||
end | ||
end | ||
|
||
describe "Constants access via .$$ with dots (regression for #1418)" do | ||
it "allows to acces scopes on `Opal`" do | ||
`Opal.Object.$$.RuntimeFixtures.$$.A.$$.B`.should == RuntimeFixtures::A::B::C | ||
This comment has been minimized.
Sorry, something went wrong. |
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
describe "Exit (Kernel#exit / Opal.exit())" do | ||
it "forwards the status code to Opal.exit(status)" do | ||
received_status { Kernel.exit }.should == 0 | ||
|
||
received_status { Kernel.exit(0) }.should == 0 | ||
received_status { Kernel.exit(1) }.should == 1 | ||
received_status { Kernel.exit(2) }.should == 2 | ||
received_status { Kernel.exit(123) }.should == 123 | ||
|
||
received_status { Kernel.exit(true) }.should == 0 | ||
received_status { Kernel.exit(false) }.should == 1 | ||
|
||
lambda { received_status { Kernel.exit(Object.new) } }.should raise_error(TypeError) | ||
lambda { received_status { Kernel.exit([]) } }.should raise_error(TypeError) | ||
lambda { received_status { Kernel.exit(/123/) } }.should raise_error(TypeError) | ||
end | ||
|
||
def received_status | ||
received_status = nil | ||
original_exit = `Opal.exit` | ||
begin | ||
`Opal.exit = function(status) { #{received_status = `status`} }` | ||
yield | ||
ensure | ||
`Opal.exit = #{original_exit}` | ||
end | ||
received_status | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
describe 'Opal.loaded' do | ||
before do | ||
%w[foo bar baz].each do |module_name| | ||
`delete Opal.require_table[#{module_name}]` | ||
`Opal.loaded_features.splice(Opal.loaded_features.indexOf(#{module_name}))` | ||
end | ||
end | ||
|
||
it 'it works with multiple paths' do | ||
`Opal.loaded(['bar'])` | ||
`(Opal.require_table.foo == null)`.should == true | ||
`(Opal.require_table.bar === true)`.should == true | ||
`(Opal.require_table.baz == null)`.should == true | ||
|
||
`Opal.loaded(['foo', 'bar', 'baz'])` | ||
`(Opal.require_table.foo === true)`.should == true | ||
`(Opal.require_table.bar === true)`.should == true | ||
`(Opal.require_table.baz === true)`.should == true | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
@elia The test is wrong no ? It should read:
or:
Right ?