-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vscode-tmgrammar-test module, include tests in ci, add unit and s…
…napshot tests for lexical constructs
- Loading branch information
Showing
10 changed files
with
4,190 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
tests/** | ||
src/** | ||
node_modules | ||
.gitkeep | ||
.gitkeep | ||
scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var cp = require('child_process') | ||
|
||
try { | ||
cp.execSync("npx vscode-tmgrammar-snap -s source.scala -g syntaxes/Scala.tmLanguage.json -t 'tests/snap/**/*.test.scala'", | ||
{ stdio: 'inherit' }) | ||
} catch(err) { | ||
console.debug(err.toString()) | ||
process.exit(-1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var cp = require('child_process') | ||
|
||
try { | ||
cp.execSync("npx vscode-tmgrammar-test -s source.scala -g syntaxes/Scala.tmLanguage.json -t 'tests/unit/**/*.test.scala'", | ||
{ stdio: 'inherit' }) | ||
} catch(err) { | ||
console.debug(err.toString()) | ||
process.exit(-1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SYNTAX TEST "source.scala" | ||
|
||
// line which start with a <comment token> but don't have valid assertions are ignored | ||
|
||
class Stack[A] { | ||
// <----- keyword.declaration.scala | ||
// ^ - keyword.declaration.scala entity.name.class.declaration | ||
// ^^^^^ entity.name.class.declaration | ||
// ^ source.scala meta.bracket.scala | ||
// ^ entity.name.class | ||
// ^ meta.bracket.scala | ||
// ^ punctuation.section.block.begin.scala | ||
private var elements: List[A] = Nil | ||
def push(x: A) { elements = x :: elements } | ||
def peek: A = elements.head | ||
def pop(): A = { | ||
val currentTop = peek | ||
elements = elements.tail | ||
currentTop | ||
} | ||
// <~~- punctuation.section.block.end.scala | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
|
||
object ExampleIdentifiers { | ||
val x = 3 | ||
val Object = 3 | ||
val maxIndex = 3 | ||
val p2p = 3 | ||
val empty_? = 3 | ||
val + = 3 | ||
val `yield` = 3 | ||
val αρετη = 3 | ||
val _y = 3 | ||
val dot_product_* = 3 | ||
val __system = 3 | ||
val _MAX_LEN_ = 3 | ||
} | ||
|
||
object IntegerLiterals { | ||
(0, 21, 0xFFFFFFFF, -42L) | ||
} | ||
|
||
object FloatingPointLiterals { | ||
( 0.0, 1e30f, 3.14159f, 1.0e-100, .1 ) | ||
} | ||
|
||
object Boolean { | ||
(true, false) | ||
} | ||
|
||
object CharacterLiterals { | ||
('a', '\u0041', '\n', '\t') | ||
} | ||
|
||
object StringLiterals { | ||
("Hello,\nWorld!", "This string contains a \" character.") | ||
|
||
"""the present string | ||
spans three | ||
lines.""" | ||
|
||
"""the present string | ||
|spans three | ||
|lines.""".stripMargin | ||
|
||
|
||
val escapeSequences = "\b\t\n\f\r\"\'\\" | ||
|
||
s"$x plain ${val x = y}" | ||
custom"$x plain ${val x = y}" | ||
|
||
s"""$x plain ${val x = y}""" | ||
custom"""$x plain ${val x = y}""" | ||
} | ||
|
||
object Symbols { | ||
('x, 'X, 'αρετη, '=, '+ ) | ||
} | ||
|
||
// single line comment | ||
|
||
/* | ||
multiline comment*/ | ||
|
||
/** | ||
* Scaladoc comment | ||
* @scaladoc @param | ||
*/ | ||
|
||
/* nested /* multi-line */ comment */ | ||
|
||
|
||
object Xml { | ||
val b = <book> | ||
<title>The Scala Language Specification</title> | ||
<version>{scalaBook.version}</version> | ||
<authors>{scalaBook.authors.mkList("", ", ", "")}</authors> | ||
</book> | ||
} |
Oops, something went wrong.