mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
enable js->ruby type conversion for floats, booleans. Add testcases for null -> nill and undefined -> nil
This commit is contained in:
parent
35a15b39d9
commit
f240e35b63
2 changed files with 11 additions and 2 deletions
|
@ -45,11 +45,11 @@ class RubyDest {
|
|||
}
|
||||
|
||||
VALUE pushDouble(double value, const char* name=0) {
|
||||
return Qnil;
|
||||
return rb_float_new(value);
|
||||
}
|
||||
|
||||
VALUE pushBool(bool value, const char* name=0) {
|
||||
return Qnil;
|
||||
return value ? Qtrue : Qfalse;
|
||||
}
|
||||
|
||||
VALUE pushNull(const char* name=0) {
|
||||
|
|
|
@ -8,6 +8,15 @@ describe "The Ruby Racer" do
|
|||
|
||||
describe "Type Conversion from Ruby to Javascript" do
|
||||
|
||||
it "can pass nil back to ruby" do
|
||||
eval("null").should be_nil
|
||||
end
|
||||
|
||||
it "passes back undefined value as nil" do
|
||||
pending "This currently causes a segmentation fault..."
|
||||
eval("this.undefined").should be_nil
|
||||
end
|
||||
|
||||
it "can pass strings back to ruby" do
|
||||
eval("'Hello World'").should == "Hello World"
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue