Wrong line number in SyntaxError out of eval
--------------------------------------------

                 Key: JRUBY-2278
                 URL: http://jira.codehaus.org/browse/JRUBY-2278
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1RC2
         Environment: Latest JRuby 1.1RC2
            Reporter: Vladimir Sizikov


The following example produces a SyntaxError (correctly), but with wrong line 
number:

{noformat}
----- File eval-syntax-error.rb ------
# empty line 1
# empty line 2
eval('if true', TOPLEVEL_BINDING, "blah.rb")
{noformat}

blah.rb:3: , unexpected end-of-file (SyntaxError)

But the line number should be not 3, but 1.

The same code exectuted inside jirb reports the line number *10*.

This also leads to one rubyspec failure:
{noformat}
Kernel#eval should include file and line information in syntax error FAILED
Expected "speccing.rb:3: , unexpected end-of-file\n"
to match /^speccing.rb:1:.+/

/opt/work/rubinius/./mspec/expectations.rb:10:in `fail_with'
/opt/work/rubinius/./mspec/matchers/base.rb:43:in `=~'
/opt/work/rubinius/./spec/ruby/1.8/core/kernel/eval_spec.rb:122
/opt/work/rubinius/./mspec/matchers/raise_error.rb:22:in `[]'
/opt/work/rubinius/./mspec/matchers/raise_error.rb:22:in `matches?'
/opt/work/rubinius/./mspec/expectations/should.rb:5:in `should'
/opt/work/rubinius/./spec/ruby/1.8/core/kernel/eval_spec.rb:119
/opt/work/rubinius/./mspec/runner/mspec.rb:111:in `call'
/opt/work/rubinius/./mspec/runner/mspec.rb:111:in `protect'
/opt/work/rubinius/./mspec/runner/state.rb:46:in `each'
/opt/work/rubinius/./mspec/runner/state.rb:46:in `protect'
/opt/work/rubinius/./mspec/runner/state.rb:59:in `process'
/opt/work/rubinius/./mspec/runner/state.rb:55:in `each'
/opt/work/rubinius/./mspec/runner/state.rb:55:in `process'
/opt/work/rubinius/./mspec/runner/mspec.rb:19:in `describe'
/opt/work/rubinius/./mspec/runner/object.rb:11:in `describe'
/opt/work/rubinius/./spec/ruby/1.8/core/kernel/eval_spec.rb:13
/opt/work/rubinius/./mspec/runner/mspec.rb:36:in `load'
/opt/work/rubinius/./mspec/runner/mspec.rb:36:in `files'
/opt/work/rubinius/./mspec/runner/mspec.rb:111:in `call'
/opt/work/rubinius/./mspec/runner/mspec.rb:111:in `protect'
/opt/work/rubinius/./mspec/runner/mspec.rb:36:in `files'
/opt/work/rubinius/./mspec/runner/mspec.rb:33:in `each'
/opt/work/rubinius/./mspec/runner/mspec.rb:33:in `files'
/opt/work/rubinius/./mspec/runner/mspec.rb:26:in `process'
mspec/bin/mspec-ci:59
{noformat}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to