summaryrefslogtreecommitdiff
path: root/tests/snippets
diff options
context:
space:
mode:
authorIlya Zorin <geraltencore@gmail.com>2021-02-06 15:49:48 +0000
committerGitHub <noreply@github.com>2021-02-06 16:49:48 +0100
commit627123cf397c2f277f12bbbda7544b59d40013a6 (patch)
tree558b39055e92e1925678dd39faa69ca59bf2fb49 /tests/snippets
parent5a4af5dc6e4005162ba09c177f29288ebaabd4cc (diff)
downloadpygments-git-627123cf397c2f277f12bbbda7544b59d40013a6.tar.gz
Improve Kotlin lexer (#1699)
Diffstat (limited to 'tests/snippets')
-rw-r--r--tests/snippets/kotlin/test_can_cope_generics_in_destructuring.txt20
-rw-r--r--tests/snippets/kotlin/test_can_cope_with_backtick_names_in_functions.txt2
-rw-r--r--tests/snippets/kotlin/test_can_cope_with_commas_and_dashes_in_backtick_Names.txt2
-rw-r--r--tests/snippets/kotlin/test_can_cope_with_destructuring.txt8
-rw-r--r--tests/snippets/kotlin/test_can_cope_with_generics.txt16
-rw-r--r--tests/snippets/kotlin/test_modifier_keyword.txt18
-rw-r--r--tests/snippets/kotlin/test_should_cope_with_multiline_comments.txt4
-rw-r--r--tests/snippets/kotlin/test_string_interpolation.txt35
8 files changed, 81 insertions, 24 deletions
diff --git a/tests/snippets/kotlin/test_can_cope_generics_in_destructuring.txt b/tests/snippets/kotlin/test_can_cope_generics_in_destructuring.txt
index 7057ea62..8a880a55 100644
--- a/tests/snippets/kotlin/test_can_cope_generics_in_destructuring.txt
+++ b/tests/snippets/kotlin/test_can_cope_generics_in_destructuring.txt
@@ -2,26 +2,26 @@
val (a: List<Something>, b: Set<Wobble>) =
---tokens---
-'val' Keyword
+'val' Keyword.Declaration
' ' Text
'(' Punctuation
-'a' Name.Property
+'a' Name.Variable
':' Punctuation
' ' Text
-'List' Name.Property
-'<' Punctuation
+'List' Name
+'<' Operator
'Something' Name
-'>' Punctuation
+'>' Operator
',' Punctuation
' ' Text
-'b' Name.Property
+'b' Name.Variable
':' Punctuation
' ' Text
-'Set' Name.Property
-'<' Punctuation
+'Set' Name
+'<' Operator
'Wobble' Name
-'>' Punctuation
+'>' Operator
')' Punctuation
' ' Text
-'=' Punctuation
+'=' Operator
'\n' Text
diff --git a/tests/snippets/kotlin/test_can_cope_with_backtick_names_in_functions.txt b/tests/snippets/kotlin/test_can_cope_with_backtick_names_in_functions.txt
index 48447109..ab2ef6d8 100644
--- a/tests/snippets/kotlin/test_can_cope_with_backtick_names_in_functions.txt
+++ b/tests/snippets/kotlin/test_can_cope_with_backtick_names_in_functions.txt
@@ -2,7 +2,7 @@
fun `wo bble`
---tokens---
-'fun' Keyword
+'fun' Keyword.Declaration
' ' Text
'`wo bble`' Name.Function
'\n' Text
diff --git a/tests/snippets/kotlin/test_can_cope_with_commas_and_dashes_in_backtick_Names.txt b/tests/snippets/kotlin/test_can_cope_with_commas_and_dashes_in_backtick_Names.txt
index 4df4e397..6d3c4ec3 100644
--- a/tests/snippets/kotlin/test_can_cope_with_commas_and_dashes_in_backtick_Names.txt
+++ b/tests/snippets/kotlin/test_can_cope_with_commas_and_dashes_in_backtick_Names.txt
@@ -2,7 +2,7 @@
fun `wo,-bble`
---tokens---
-'fun' Keyword
+'fun' Keyword.Declaration
' ' Text
'`wo,-bble`' Name.Function
'\n' Text
diff --git a/tests/snippets/kotlin/test_can_cope_with_destructuring.txt b/tests/snippets/kotlin/test_can_cope_with_destructuring.txt
index e9fab5e9..b51c1e04 100644
--- a/tests/snippets/kotlin/test_can_cope_with_destructuring.txt
+++ b/tests/snippets/kotlin/test_can_cope_with_destructuring.txt
@@ -2,15 +2,15 @@
val (a, b) =
---tokens---
-'val' Keyword
+'val' Keyword.Declaration
' ' Text
'(' Punctuation
-'a' Name.Property
+'a' Name.Variable
',' Punctuation
' ' Text
-'b' Name.Property
+'b' Name.Variable
')' Punctuation
' ' Text
-'=' Punctuation
+'=' Operator
' ' Text
'\n' Text
diff --git a/tests/snippets/kotlin/test_can_cope_with_generics.txt b/tests/snippets/kotlin/test_can_cope_with_generics.txt
index 554a820a..ed616ec3 100644
--- a/tests/snippets/kotlin/test_can_cope_with_generics.txt
+++ b/tests/snippets/kotlin/test_can_cope_with_generics.txt
@@ -2,9 +2,11 @@
inline fun <reified T : ContractState> VaultService.queryBy(): Vault.Page<T> {
---tokens---
-'inline fun' Keyword
+'inline' Keyword.Declaration
' ' Text
-'<' Punctuation
+'fun' Keyword.Declaration
+' ' Text
+'<' Operator
'reified' Keyword
' ' Text
'T' Name
@@ -12,9 +14,9 @@ inline fun <reified T : ContractState> VaultService.queryBy(): Vault.Page<T> {
':' Punctuation
' ' Text
'ContractState' Name
-'>' Punctuation
+'>' Operator
' ' Text
-'VaultService' Name.Class
+'VaultService' Name
'.' Punctuation
'queryBy' Name.Function
'(' Punctuation
@@ -23,10 +25,10 @@ inline fun <reified T : ContractState> VaultService.queryBy(): Vault.Page<T> {
' ' Text
'Vault' Name
'.' Punctuation
-'Page' Name
-'<' Punctuation
+'Page' Name.Attribute
+'<' Operator
'T' Name
-'>' Punctuation
+'>' Operator
' ' Text
'{' Punctuation
'\n' Text
diff --git a/tests/snippets/kotlin/test_modifier_keyword.txt b/tests/snippets/kotlin/test_modifier_keyword.txt
new file mode 100644
index 00000000..b30f65b9
--- /dev/null
+++ b/tests/snippets/kotlin/test_modifier_keyword.txt
@@ -0,0 +1,18 @@
+---input---
+data class A(val data: String)
+
+---tokens---
+'data' Keyword.Declaration
+' ' Text
+'class' Keyword.Declaration
+' ' Text
+'A' Name.Class
+'(' Punctuation
+'val' Keyword.Declaration
+' ' Text
+'data' Name.Variable
+':' Punctuation
+' ' Text
+'String' Keyword.Type
+')' Punctuation
+'\n' Text
diff --git a/tests/snippets/kotlin/test_should_cope_with_multiline_comments.txt b/tests/snippets/kotlin/test_should_cope_with_multiline_comments.txt
index 3de13278..ee7c3275 100644
--- a/tests/snippets/kotlin/test_should_cope_with_multiline_comments.txt
+++ b/tests/snippets/kotlin/test_should_cope_with_multiline_comments.txt
@@ -6,5 +6,7 @@ a
comment"""
---tokens---
-'"""\nthis\nis\na\ncomment"""' Literal.String
+'"""' Literal.String
+'\nthis\nis\na\ncomment' Literal.String
+'"""' Literal.String
'\n' Text
diff --git a/tests/snippets/kotlin/test_string_interpolation.txt b/tests/snippets/kotlin/test_string_interpolation.txt
new file mode 100644
index 00000000..c254f112
--- /dev/null
+++ b/tests/snippets/kotlin/test_string_interpolation.txt
@@ -0,0 +1,35 @@
+---input---
+val something = "something"
+"Here is $something"
+"Here is ${something.toUpperList()}"
+
+---tokens---
+'val' Keyword.Declaration
+' ' Text
+'something' Name.Variable
+' ' Text
+'=' Operator
+' ' Text
+'"' Literal.String
+'something' Literal.String
+'"' Literal.String
+'\n' Text
+
+'"' Literal.String
+'Here is ' Literal.String
+'$' Literal.String.Interpol
+'something' Name
+'"' Literal.String
+'\n' Text
+
+'"' Literal.String
+'Here is ' Literal.String
+'${' Literal.String.Interpol
+'something' Name
+'.' Punctuation
+'toUpperList' Name.Attribute
+'(' Punctuation
+')' Punctuation
+'}' Literal.String.Interpol
+'"' Literal.String
+'\n' Text