Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Question: Test assertion #6

Closed
elcuervo opened this issue Apr 7, 2011 · 3 comments
Closed

Question: Test assertion #6

elcuervo opened this issue Apr 7, 2011 · 3 comments

Comments

@elcuervo
Copy link
Contributor

elcuervo commented Apr 7, 2011

Hello, as you noticed i'm working in the integration with Mustang, some namescope issues where fixed and i'm preparing the commit again, but now i have a question in test/test_runtimes.rb:24 and :10 is this assertion:

assert_nil @runtime.eval("function() {}")

"function() {}" works in most of the runtimes but in V8 raises "SyntaxError: Unexpected token (". This assertion is correct? or should be deleted or tested in the SyntaxtError tests?

@josh
Copy link
Contributor

josh commented Apr 7, 2011

Its evaled as (function() {}) which works as expected.

V8::Context.new.eval("(function() {})")

https://github.com/sstephenson/execjs/blob/master/lib/execjs/ruby_racer_runtime.rb#L17

@josh josh closed this as completed Apr 7, 2011
@elcuervo
Copy link
Contributor Author

elcuervo commented Apr 7, 2011

You are right, my mistake.
But why the assertion to nil?
Just want to understand the code :D

Bruno Aguirre
brunoaguirre.com
On Thursday, April 7, 2011 at 11:12 AM, josh wrote:

Its evaled as (function() {}) which works as expected.

V8::Context.new.eval("(function() {})")

https://github.com/sstephenson/execjs/blob/master/lib/execjs/ruby_racer_runtime.rb#L17

Reply to this email directly or view it on GitHub:
#6 (comment)

@josh
Copy link
Contributor

josh commented Apr 7, 2011

ExecJS does not support functions as a return type. All return values must be a JSON type. This ensures a consistent api across all the engines.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants