Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coffeescript test suite errors after parser build? #3750

Closed
GabrielRatener opened this issue Dec 3, 2014 · 4 comments
Closed

Coffeescript test suite errors after parser build? #3750

GabrielRatener opened this issue Dec 3, 2014 · 4 comments

Comments

@GabrielRatener
Copy link
Contributor

When forking coffeescript, I run $ cake test, with all but 3 tests passing. But after running

$ cake build
$ cake build:parser
$ cake test

with no modifications, 9 tests fail. Is there something I am doing wrong or is this a bug?

@jashkenas
Copy link
Owner

Perhaps you have a newer version of Jison installed? And we need to update?

Can you investigate the nature of the errors?

@GabrielRatener
Copy link
Contributor Author

Here is the output from the tests:

failed 9 and passed 579 tests in 3.56 seconds 

  parser error formating 
  AssertionError: Expected [stdin]:1:15: error: unexpected in
foo in bar or in baz
              ^^ to equal TypeError: Cannot read property '0' of undefined


  function () {
    return assertErrorFormat('foo in bar or in baz', '[stdin]:1:15: error: unexpected in\nfoo in bar or in baz\n              ^^');
  }

  compiler error formatting with mixed tab and space 
  AssertionError: Expected [stdin]:1:4: error: unexpected if
      if a
      ^^ to equal TypeError: Cannot read property '0' of undefined


  function () {
    return assertErrorFormat("\t  if a\n\t  test", '[stdin]:1:4: error: unexpected if\n\t  if a\n\t  ^^');
  }

  #2849: compilation error in a require()d file 
  AssertionError: Expected /Users/macbookpro/Apps/coffeescript/test/syntax-error.coffee:1:15: error: unexpected in
foo in bar or in baz
              ^^ to equal TypeError: Cannot read property '0' of undefined


  function () {
      ok(!fs.existsSync('test/syntax-error.coffee'));
      fs.writeFileSync('test/syntax-error.coffee', 'foo in bar or in baz');
      try {
        return assertErrorFormat('require \'./test/syntax-error\'', "" + (path.join(__dirname, 'syntax-error.coffee')) + ":1:15: error: unexpected in\nfoo in bar or in baz\n              ^^");
      } finally {
        fs.unlink('test/syntax-error.coffee');
      }
    }

  #1096: unexpected generated tokens 
  AssertionError: Expected [stdin]:1:3: error: unexpected string interpolation
{"#{key}": val}
  ^^ to equal TypeError: Cannot read property '0' of undefined


  function () {
    assertErrorFormat('{"#{key}": val}', '[stdin]:1:3: error: unexpected string interpolation\n{"#{key}": val}\n  ^^');
    assertErrorFormat('a:, b', '[stdin]:1:3: error: unexpected ,\na:, b\n  ^');
    assertErrorFormat('(a:)', '[stdin]:1:4: error: unexpected )\n(a:)\n   ^');
    assertErrorFormat('a:', '[stdin]:1:3: error: unexpected end of input\na:\n  ^');
    return assertErrorFormat('for i in [1]:\n  1', '[stdin]:1:13: error: unexpected :\nfor i in [1]:\n            ^');
  }

  #3325: implicit indentation errors 
  AssertionError: Expected [stdin]:1:14: error: unexpected then
i for i in a then i
             ^^^^ to equal TypeError: Cannot read property '0' of undefined


  function () {
    return assertErrorFormat('i for i in a then i', '[stdin]:1:14: error: unexpected then\ni for i in a then i\n             ^^^^');
  }

  explicit indentation errors 
  AssertionError: Expected [stdin]:2:1: error: unexpected indentation
  c
^^ to equal TypeError: Cannot read property '0' of undefined


  function () {
    return assertErrorFormat('a = b\n  c', '[stdin]:2:1: error: unexpected indentation\n  c\n^^');
  }

  CoffeeScript.eval can run in, and modify, a Script context sandbox 
  TypeError: undefined is not a function
  at Function.<anonymous> (/Users/macbookpro/Apps/coffeescript/test/eval.coffee:13:25)
  at global.test (/Users/macbookpro/Apps/coffeescript/Cakefile:276:12)
  at Object.<anonymous> (/Users/macbookpro/Apps/coffeescript/test/eval.coffee:12:3)
  at Object.<anonymous> (/Users/macbookpro/Apps/coffeescript/test/eval.coffee:1:1)
  at Module._compile (module.js:449:26)

  function () {
      var code, result, sandbox;
      sandbox = vm.Script.createContext();
      sandbox.foo = 'bar';
      code = 'global.foo = \'not bar!\'';
      result = CoffeeScript["eval"](code, {
        sandbox: sandbox
      });
      eq(result, 'not bar!');
      return eq(sandbox.foo, 'not bar!');
    }

  CoffeeScript.eval can run in, but cannot modify, an ordinary object sandbox 
  TypeError: undefined is not a function
  at Object.exports.eval (/Users/macbookpro/Apps/coffeescript/lib/coffee-script/coffee-script.js:133:47)
  at Function.<anonymous> (/Users/macbookpro/Apps/coffeescript/test/eval.coffee:27:14)
  at global.test (/Users/macbookpro/Apps/coffeescript/Cakefile:276:12)
  at Object.<anonymous> (/Users/macbookpro/Apps/coffeescript/test/eval.coffee:22:3)
  at Object.<anonymous> (/Users/macbookpro/Apps/coffeescript/test/eval.coffee:1:1)
  at Module._compile (module.js:449:26)

  function () {
      var code, result, sandbox;
      sandbox = {
        foo: 'bar'
      };
      code = 'global.foo = \'not bar!\'';
      result = CoffeeScript["eval"](code, {
        sandbox: sandbox
      });
      eq(result, 'not bar!');
      return eq(sandbox.foo, 'bar');
    }

  keeps running after runtime error 
  AssertionError: Expected 0 to equal -1
  at global.eq (/Users/macbookpro/Apps/coffeescript/Cakefile:313:65)
  at /Users/macbookpro/Apps/coffeescript/test/repl.coffee:106:28
  at Function.<anonymous> (/Users/macbookpro/Apps/coffeescript/test/repl.coffee:38:17)
  at global.test (/Users/macbookpro/Apps/coffeescript/Cakefile:276:12)
  at testRepl (/Users/macbookpro/Apps/coffeescript/test/repl.coffee:38:8)
  at Object.<anonymous> (/Users/macbookpro/Apps/coffeescript/test/repl.coffee:104:1)
  at Object.<anonymous> (/Users/macbookpro/Apps/coffeescript/test/repl.coffee:1:1)
  at Module._compile (module.js:449:26)

  function () {
      return fn(input, output, repl);
    }

Using Jison v0.4.15

@lydell
Copy link
Collaborator

lydell commented Jan 15, 2015

Fixed by #3794.

@kid-wumeng
Copy link

@lydell Thank you very much ! It's nice !

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

No branches or pull requests

5 participants