diff options
| author | Connor Lay (Clay) <connorlay@pm.me> | 2022-02-12 17:58:14 -0800 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-02-15 19:01:02 +0100 |
| commit | 00dce4478066b84caa6af0a25fcca79fa32b58a3 (patch) | |
| tree | 4beb9f8dc253d50e5bf2d0aede9a8b7ec4339e59 /tests/query | |
| parent | Gleam indentation tests (diff) | |
| download | nvim-treesitter-00dce4478066b84caa6af0a25fcca79fa32b58a3.tar nvim-treesitter-00dce4478066b84caa6af0a25fcca79fa32b58a3.tar.gz nvim-treesitter-00dce4478066b84caa6af0a25fcca79fa32b58a3.tar.bz2 nvim-treesitter-00dce4478066b84caa6af0a25fcca79fa32b58a3.tar.lz nvim-treesitter-00dce4478066b84caa6af0a25fcca79fa32b58a3.tar.xz nvim-treesitter-00dce4478066b84caa6af0a25fcca79fa32b58a3.tar.zst nvim-treesitter-00dce4478066b84caa6af0a25fcca79fa32b58a3.zip | |
Gleam highlight tests
Diffstat (limited to 'tests/query')
| -rw-r--r-- | tests/query/highlights/gleam/assert.gleam | 13 | ||||
| -rw-r--r-- | tests/query/highlights/gleam/function.gleam | 127 | ||||
| -rw-r--r-- | tests/query/highlights/gleam/import.gleam | 22 | ||||
| -rw-r--r-- | tests/query/highlights/gleam/pipe.gleam | 18 | ||||
| -rw-r--r-- | tests/query/highlights/gleam/todo.gleam | 7 | ||||
| -rw-r--r-- | tests/query/highlights/gleam/try.gleam | 11 | ||||
| -rw-r--r-- | tests/query/highlights/gleam/type.gleam | 83 |
7 files changed, 281 insertions, 0 deletions
diff --git a/tests/query/highlights/gleam/assert.gleam b/tests/query/highlights/gleam/assert.gleam new file mode 100644 index 000000000..e49b3d2c4 --- /dev/null +++ b/tests/query/highlights/gleam/assert.gleam @@ -0,0 +1,13 @@ +pub fn main() { + assert Ok(i) = parse_int("123") + // <- exception + // ^ type + // ^ punctuation.bracket + // ^ variable + // ^ punctuation.bracket + // ^ operator + // ^ function + // ^ punctuation.bracket + // ^ string + // ^ punctuation.bracket +} diff --git a/tests/query/highlights/gleam/function.gleam b/tests/query/highlights/gleam/function.gleam new file mode 100644 index 000000000..89a302706 --- /dev/null +++ b/tests/query/highlights/gleam/function.gleam @@ -0,0 +1,127 @@ +pub fn add(x: Int, y: Int) -> Int { +// <- keyword +// ^ keyword.function +// ^ function +// ^ punctuation.bracket +// ^ parameter +// ^ parameter +// ^ type +// ^ punctuation.delimiter +// ^ parameter +// ^ parameter +// ^ type +// ^ punctuation.bracket +// ^ operator +// ^ type +// ^ punctuation.bracket +} +// <- punctuation.bracket + +pub fn twice(f: fn(t) -> t, x: t) -> t { +// <- keyword +// ^ keyword.function +// ^ function +// ^ punctuation.bracket +// ^ parameter +// ^ parameter +// ^ keyword.function +// ^ punctuation.bracket +// ^ type +// ^ punctuation.bracket +// ^ operator +// ^ type +// ^ punctuation.delimiter +// ^ parameter +// ^ parameter +// ^ type +// ^ punctuation.bracket +// ^ operator +// ^ type +// ^ punctuation.bracket +} +// <- punctuation.bracket + +fn list_of_two(my_value: a) -> List(a) { +// <- keyword.function +// ^ function +// ^ punctuation.bracket +// ^ parameter +// ^ parameter +// ^ type +// ^ punctuation.bracket +// ^ operator +// ^ type +// ^ punctuation.bracket +// ^ type +// ^ punctuation.bracket +// ^ punctuation.bracket +} +// <- punctuation.bracket + +fn replace( +// <- keyword.function +// ^ function +// ^ punctuation.bracket + in string: String, + // <- symbol + // ^ parameter + // ^ parameter + // ^ type + // ^ punctuation.delimiter + each pattern: String, + // <- symbol + // ^ parameter + // ^ parameter + // ^ type + // ^ punctuation.delimiter + with replacement: String, + // <- symbol + // ^ parameter + // ^ parameter + // ^ type + // ^ punctuation.delimiter +) { + replace(in: "A,B,C", each: ",", with: " ") + // <- function + // ^ punctuation.bracket + // ^ symbol + // ^ symbol + // ^ string + // ^ punctuation.delimiter + // ^ symbol + // ^ symbol + // ^ string + // ^ punctuation.delimiter + // ^ symbol + // ^ symbol + // ^ string + // ^ punctuation.bracket +} +// <- punctuation.bracket + +pub external fn random_float() -> Float = "rand" "uniform" +// <- keyword +// ^ keyword +// ^ keyword.function +// ^ function +// ^ punctuation.bracket +// ^ punctuation.bracket +// ^ operator +// ^ type +// ^ operator +// ^ namespace +// ^ function + +pub external fn inspect(a) -> a = "Elixir.IO" "inspect" +// <- keyword +// ^ keyword +// ^ keyword.function +// ^ function +// ^ punctuation.bracket +// ^ type +// ^ punctuation.bracket +// ^ operator +// ^ type +// ^ operator +// ^ namespace +// ^ function diff --git a/tests/query/highlights/gleam/import.gleam b/tests/query/highlights/gleam/import.gleam new file mode 100644 index 000000000..28356ca8c --- /dev/null +++ b/tests/query/highlights/gleam/import.gleam @@ -0,0 +1,22 @@ +import gleam/io +// <- include +// ^ namespace +// ^ namespace +// ^ namespace + +import cat as kitten +// <- include +// ^ namespace +// ^ keyword +// ^ namespace + +import animal/cat.{Cat, stroke} +// <- include +// ^ namespace +// ^ namespace +// ^ punctuation.delimiter +// ^ punctuation.bracket +// ^ type +// ^ punctuation.delimiter +// ^ function +// ^ punctuation.bracket diff --git a/tests/query/highlights/gleam/pipe.gleam b/tests/query/highlights/gleam/pipe.gleam new file mode 100644 index 000000000..33f27312b --- /dev/null +++ b/tests/query/highlights/gleam/pipe.gleam @@ -0,0 +1,18 @@ +pub fn run() { + 1 + // <- number + |> add(_, 2) + // <- operator + // ^ function + // ^ punctuation.bracket + // ^ comment + // ^ punctuation.delimiter + // ^ number + // ^ punctuation.bracket + |> add(3) + // <- operator + // ^ function + // ^ punctuation.bracket + // ^ number + // ^ punctuation.bracket +} diff --git a/tests/query/highlights/gleam/todo.gleam b/tests/query/highlights/gleam/todo.gleam new file mode 100644 index 000000000..27038bb73 --- /dev/null +++ b/tests/query/highlights/gleam/todo.gleam @@ -0,0 +1,7 @@ +fn favourite_number() -> Int { + todo("We're going to decide which number is best tomorrow") + // <- keyword + // ^ punctuation.bracket + // ^ string + // ^ punctuation.bracket +} diff --git a/tests/query/highlights/gleam/try.gleam b/tests/query/highlights/gleam/try.gleam new file mode 100644 index 000000000..136d44eb4 --- /dev/null +++ b/tests/query/highlights/gleam/try.gleam @@ -0,0 +1,11 @@ +pub fn main() { + try x = Ok(1) + // <- keyword + // ^ variable + // ^ operator + // ^ type + // ^ punctuation.bracket + // ^ number + // ^ punctuation.bracket + Ok(x + 1) +} diff --git a/tests/query/highlights/gleam/type.gleam b/tests/query/highlights/gleam/type.gleam new file mode 100644 index 000000000..08887e021 --- /dev/null +++ b/tests/query/highlights/gleam/type.gleam @@ -0,0 +1,83 @@ +pub type Cat { +// <- keyword +// ^ keyword.function +// ^ type +// ^ punctuation.bracket + Cat(name: String, cuteness: Int) + // <- type + // ^ punctuation.bracket + // ^ property + // ^ property + // ^ type + // ^ punctuation.delimiter + // ^ property + // ^ property + // ^ type + // ^ punctuation.bracket +} + +fn cats() { + Cat(name: "Nubi", cuteness: 2001) + // <- type + // ^ punctuation.bracket + // ^ property + // ^ property + // ^ string + // ^ punctuation.delimiter + // ^ property + // ^ property + // ^ number + Cat("Ginny", 1950) + // <- type + // ^ punctuation.bracket + // ^ string + // ^ punctuation.delimiter + // ^ number + // ^ punctuation.bracket +} + +type Box(inner_type) { +// <- keyword.function +// ^ type +// ^ punctuation.bracket +// ^ parameter +// ^ punctuation.bracket +// ^ punctuation.bracket + Box(inner: inner_type) + // <- type + // ^ punctuation.bracket + // ^ property + // ^ property + // ^ type + // ^ punctuation.bracket +} + +pub opaque type Counter { +// <- keyword +// ^ keyword +// ^ keyword.function +// ^ type +// ^ punctuation.bracket + Counter(value: Int) +} + +pub fn have_birthday(person) { + Person(..person, age: person.age + 1, is_happy: True) + // <- type + // ^ punctuation.bracket + // ^ operator + // ^ variable + // ^ punctuation.delimiter + // ^ property + // ^ property + // ^ variable + // ^ punctuation.delimiter + // ^ property + // ^ operator + // ^ number + // ^ punctuation.delimiter + // ^ property + // ^ property + // ^ boolean + // ^ punctuation.bracket +} |
