1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

Tweak extconf to generate test target that

calls ruby spec.
This commit is contained in:
Bill Robertson 2009-10-15 23:45:53 -04:00
parent 456fa3a282
commit be8f4b2594
4 changed files with 31 additions and 16 deletions

29
build_all_and_test.txt Normal file
View file

@ -0,0 +1,29 @@
g++ -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin10 -I. -I/Users/bill/dev/rubyracer/google-v8//include -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/opt/local/include -fno-common -O2 -arch x86_64 -fno-common -pipe -fno-common -arch x86_64 -c generic_data.cpp
g++ -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin10 -I. -I/Users/bill/dev/rubyracer/google-v8//include -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/opt/local/include -fno-common -O2 -arch x86_64 -fno-common -pipe -fno-common -arch x86_64 -c ruby_data.cpp
g++ -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin10 -I. -I/Users/bill/dev/rubyracer/google-v8//include -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/opt/local/include -fno-common -O2 -arch x86_64 -fno-common -pipe -fno-common -arch x86_64 -c v8.cpp
g++ -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin10 -I. -I/Users/bill/dev/rubyracer/google-v8//include -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/opt/local/include -fno-common -O2 -arch x86_64 -fno-common -pipe -fno-common -arch x86_64 -c v8_data.cpp
/usr/bin/gcc-4.2 -dynamic -bundle -undefined suppress -flat_namespace -o v8.bundle generic_data.o ruby_data.o v8.o v8_data.o -L. -L/opt/local/lib -L/Users/bill/dev/rubyracer/google-v8/ -L. -L/opt/local/lib -arch x86_64 -lruby -lv8 -lpthread -ldl -lobjc
running spec...
spec spec/therubyracer_spec.rb
FF.F
1)
'The Ruby Racer Type Conversion from Ruby to Javascript can pass strings back to ruby' FAILED
expected: "Hello World",
got: nil (using ==)
./spec/therubyracer_spec.rb:12:
2)
'The Ruby Racer Type Conversion from Ruby to Javascript can pass doubles back to ruby' FAILED
expected: 2.5,
got: nil (using ==)
./spec/therubyracer_spec.rb:16:
3)
'The Ruby Racer Type Conversion from Ruby to Javascript can pass boolean values back to ruby' FAILED
expected true, got nil
./spec/therubyracer_spec.rb:24:
Finished in 0.023274 seconds
4 examples, 3 failures

View file

@ -10,6 +10,7 @@ File.open("Makefile", "a") do |makefile|
makefile.print <<EOF
test: all
@echo add test build/run here.
@echo running spec...
spec spec/therubyracer_spec.rb
EOF
end

3
v8.cpp
View file

@ -7,7 +7,6 @@ typedef struct v8_context {
v8_context() : context(v8::Context::New()) {}
~v8_context() {
context.Dispose();
printf("disposing of context\n");
}
v8::Persistent<v8::Context> context;
} v8_context;
@ -35,7 +34,6 @@ extern "C" {
}
VALUE v8_allocate(VALUE clazz) {
printf("v8_allocate()\n");
v8_context *s = new v8_context;
return Data_Wrap_Struct(clazz, v8_mark, v8_free, s);
}
@ -56,7 +54,6 @@ VALUE eval(VALUE self, VALUE javascript) {
RubyDataSource<StringDest, std::string> tostring;
const std::string text(tostring.push(javascript));
printf("v8_allocate(\"%s\")\n", text.c_str());
v8::Handle<v8::String> source = v8::String::New(text.c_str());
v8::Handle<v8::Script> script = v8::Script::Compile(source);

View file

@ -17,42 +17,30 @@ template<class T, class R> class V8HandleSource {
R push(v8::Handle<v8::Value>& value, const char* name = 0) {
printf("******* enter push()\n");
if(value->IsNull()) {
return dest.pushNull(name);
}
printf("******* isNull() == false\n");
if(value->IsTrue()) {
return dest.pushBool(true, name);
}
printf("******* isTrue() == false\n");
if(value->IsFalse()) {
return dest.pushBool(false, name);
}
printf("******* isFalse() == false\n");
if(value->IsString()) {
//v8::Local<v8:String::AsciiValue> strValue(value->ToString());
return dest.pushString("", name);
}
printf("******* isString() == false\n");
if(value->IsInt32()) {
return dest.pushInt(value->Int32Value(), name);
}
printf("******* isInt32() == false\n");
if(value->IsNumber()) {
return dest.pushDouble(value->NumberValue(), name);
}
printf("******* isNumber() == false\n");
}
};