map literals
This commit is contained in:
1 parent
cb9df79ce3
commit
d118d29429
16 files changed
+669
-78
No files matched your search
@@ -44,6 +44,26 @@ class HighlightSmokeTest {
|
||||
assertTrue(labeled.any { it.first == "2" && it.second == HighlightKind.Number })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun highlightMapLiteralHtml() {
|
||||
val text = """
|
||||
val base = { a: 1, b: }
|
||||
val m = { "a": 1, b: , ...base, }
|
||||
""".trimIndent()
|
||||
val html = SiteHighlight.renderHtml(text)
|
||||
// Curly braces and commas are punctuation
|
||||
assertContains(html, "<span class=\"hl-punc\">{</span>")
|
||||
assertContains(html, "<span class=\"hl-punc\">}</span>")
|
||||
assertTrue(html.contains("hl-punc") && html.contains(","), "comma should be punctuation")
|
||||
// Colon after key is punctuation
|
||||
assertContains(html, "<span class=\"hl-punc\">:</span>")
|
||||
// Spread operator present
|
||||
assertContains(html, "<span class=\"hl-op\">...</span>")
|
||||
// String key and identifier key appear
|
||||
assertContains(html, "<span class=\"hl-str\">\"a\"</span>")
|
||||
assertContains(html, "<span class=\"hl-id\">b</span>")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun renderHtmlContainsCorrectClasses() {
|
||||
val text = "assertEquals( [9,10], r.takeLast(2).toList() )"
|
||||
|
||||
Reference in new issue
Block a user