Skip to content

Commit

Permalink
🧪 Breakdown test cases and add todos (#20)
Browse files Browse the repository at this point in the history
* chore: move test files into subdirectories

* chore: first pass test run through

* feat: add hex constants

* chore: add todos

* chore: regen snapshots
  • Loading branch information
nefrob authored Jun 23, 2024
1 parent 2e2589e commit 287ef2f
Show file tree
Hide file tree
Showing 37 changed files with 1,173 additions and 619 deletions.
5 changes: 5 additions & 0 deletions syntaxes/just.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
"comment": "Integer",
"name": "constant.language.integer.just",
"match": "\\b\\d+\\b"
},
{
"comment": "Hex",
"name": "constant.language.hex.just",
"match": "\\b(HEX|HEXLOWER|HEXUPPER)\\b"
}
]
},
Expand Down
3 changes: 3 additions & 0 deletions syntaxes/just.tmLanguage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ repository:
- comment: Integer
name: constant.language.integer.just
match: "\\b\\d+\\b"
- comment: Hex
name: constant.language.hex.just
match: "\\b(HEX|HEXLOWER|HEXUPPER)\\b"

keywords:
patterns:
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions tests/embedded.just → tests/embedded/embedded.just
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Embedded languages

# TODO: how to test embedded grammars in snapshots?

python:
#!/usr/bin/env python3
print('Hello from python!')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
># Embedded languages
#^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just
>
># TODO: how to test embedded grammars in snapshots?
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just
>
>python:
#^^^^^^ source.just entity.name.function.just
# ^ source.just keyword.operator.recipe.end.just
Expand Down
18 changes: 0 additions & 18 deletions tests/escaping.just

This file was deleted.

85 changes: 0 additions & 85 deletions tests/escaping.just.snap

This file was deleted.

3 changes: 0 additions & 3 deletions tests/general.just

This file was deleted.

6 changes: 0 additions & 6 deletions tests/general.just.snap

This file was deleted.

15 changes: 15 additions & 0 deletions tests/builtins.just → tests/general/builtins.just
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Builin keywords

alias
set
export
import
mod

# Control keywords

if
else

# Builtin functions

# TODO: should parentheses be optional or required?

# System info

arch()
Expand Down
25 changes: 25 additions & 0 deletions tests/builtins.just.snap → tests/general/builtins.just.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
># Builin keywords
#^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just
>
>alias
#^^^^^ source.just keyword.other.reserved.just
>set
#^^^ source.just keyword.other.reserved.just
>export
#^^^^^^ source.just keyword.other.reserved.just
>import
#^^^^^^ source.just keyword.other.reserved.just
>mod
#^^^ source.just keyword.other.reserved.just
>
># Control keywords
#^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just
>
>if
#^^ source.just keyword.control.conditional.just
>else
#^^^^ source.just keyword.control.conditional.just
>
># Builtin functions
#^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just
>
># TODO: should parentheses be optional or required?
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just
>
># System info
#^^^^^^^^^^^^^ source.just comment.line.number-sign.just
>
Expand Down
8 changes: 8 additions & 0 deletions tests/general/constants.just
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Constants

true
false

HEX
HEXLOWER
HEXUPPER
15 changes: 15 additions & 0 deletions tests/general/constants.just.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
># Constants
#^^^^^^^^^^^ source.just comment.line.number-sign.just
>
>true
#^^^^ source.just constant.language.boolean.just
>false
#^^^^^ source.just constant.language.boolean.just
>
>HEX
#^^^ source.just constant.language.hex.just
>HEXLOWER
#^^^^^^^^ source.just constant.language.hex.just
>HEXUPPER
#^^^^^^^^ source.just constant.language.hex.just
>
17 changes: 17 additions & 0 deletions tests/general/general.just
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Comments

# Standard comment

something # Comment after code

# Numbers

123
# TODO: should the "." be colored differently?
123.456

# Imports

import 'foo/bar.just'

mod bar
37 changes: 37 additions & 0 deletions tests/general/general.just.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
># Comments
#^^^^^^^^^^ source.just comment.line.number-sign.just
>
># Standard comment
#^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just
>
>something # Comment after code
#^^^^^^^^^^ source.just
# ^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just
>
># Numbers
#^^^^^^^^^ source.just comment.line.number-sign.just
>
>123
#^^^ source.just constant.language.integer.just
># TODO: should the "." be colored differently?
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.just comment.line.number-sign.just
>123.456
#^^^ source.just constant.language.integer.just
# ^ source.just
# ^^^ source.just constant.language.integer.just
>
># Imports
#^^^^^^^^^ source.just comment.line.number-sign.just
>
>import 'foo/bar.just'
#^^^^^^ source.just keyword.other.reserved.just
# ^ source.just
# ^ source.just string.quoted.single.just string.quoted.single.just
# ^^^^^^^^^^^^ source.just string.quoted.single.just
# ^ source.just string.quoted.single.just
>
>mod bar
#^^^ source.just keyword.other.reserved.just
# ^ source.just
# ^^^^ source.just
>
63 changes: 63 additions & 0 deletions tests/general/multi-line-constructs.just
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Multi-line constructs

# TODO: do we need to validate this?
# TODO: should just-specific highlighting in recipes be conditional (ex. only in interpolation blocks)
# or always on?

multi-line-recipe:
if true; then \
echo 'True!'; \
fi


# Parenthesis blocks don't need explicit line breaks

abc := ('a' +
'b'
+ 'c')

abc2 := (
'a' +
'b' +
'c'
)

# TODO: multi-line recipe def broken

foo param=('foo'
+ 'bar'
):
echo {{param}}

bar: (foo
'Foo'
)
echo 'Bar!'

# Backslash continues as if whitespace

a := 'foo' + \
'bar'

foo param1 \
param2='foo' \
*varparam='': dep1 \
(dep2 'foo')
echo {{param1}} {{param2}} {{varparam}}

dep1: \
# this comment is not part of the recipe body
echo 'dep1'

dep2 \
param:
echo 'Dependency with parameter {{param}}'

# Line continuation in interpolations

recipe:
echo '{{ \
"This interpolation " + \
"has a lot of text." \
}}'
echo 'back to recipe body'
Loading

0 comments on commit 287ef2f

Please sign in to comment.