alexschneider / teascript

5 stars 2 forks source link

Scanner test not testing multiline strings properly #63

Open alexschneider opened 9 years ago

alexschneider commented 9 years ago

Anywhere we test a multiline string, though the string appear to be multiline, coffeescript turns it into a single line string when compiled.

See https://github.com/alexschneider/teascript/blob/master/test/scanner/line_scanner/string_literals_spec.coffee#L30-L31 for example.

I'm not sure the best way to fix this, because adding a linebreak simply adds a linebreak token in coffeescript, it doesn't actually emulate a multiline string being passed in... @rachelriv, do you mind taking a look?

Also, to further illustrate what I'm talking about:

$ echo console.log \'test\\ntest\' > test.coffee && coffee test.coffee
test test
$ cat test.coffee
console.log 'test
test'
rtoal commented 9 years ago

What is the problem here? This is the way string literals work in CoffeeScript.

alexschneider commented 9 years ago

@rtoal In our unit tests, we're not testing the scanner's ability to handle multiline strings.

rtoal commented 9 years ago

Did you define teascript to work like CoffeeScript or do teascript multiline strings work more like CoffeeScript's triple-quoted strings?

alexschneider commented 9 years ago

teascript should work like coffeescript in this regard. We don't plan on having triple quoted strings that preserve formatting and whatnot.

rachelriv commented 9 years ago

Great catch Alex! I'll make sure to add in some newline tokens to the tests. It should be an easy fix.