Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-semenov committed Apr 29, 2024
1 parent c317772 commit cdb9cbb
Show file tree
Hide file tree
Showing 7 changed files with 234 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:
hooks:
- id: jsonlint
name: lints json
entry: jsonlint --nonstrict
entry: jsonlint
language: system
files: '.*\.(json|JSON-tmLanguage)'
# yaml
Expand Down
4 changes: 2 additions & 2 deletions src/functions.YAML-tmLanguage.j2
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ repository:
user-defined:
patterns:
-
match: '([[:alpha:]][[:alnum:]_]*)\b\s*(\(|\(\s*\{|\{\s*\()'
match: '([[:alpha:]][[:alnum:]_]*)\b(?=\s*\(|\(\s*\{|\{\s*\()'
captures:
1:
name: entity.name.function.user.parigp

-
match: '([[:alpha:]][[:alnum:]_]*)\b\s*=\s*\{?\s*(\([^\(]+\)|[[:alpha:]][[:alnum:]_]*)\s*-\s*>'
match: '([[:alpha:]][[:alnum:]_]*)\b(?=\s*=\s*\{?\s*(\([^\(]+\)|[[:alpha:]][[:alnum:]_]*)\s*-\s*>)'
captures:
1:
name: entity.name.function.user.lambda.parigp
2 changes: 1 addition & 1 deletion src/literals.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repository:
match: '\b(0(b|B)[0-1]*)\b'
name: constant.numeric.bin.parigp
-
match: '\b([0-9]*\.[0-9]*\s*[eE][+-]?[0-9]+)\b'
match: '([0-9]*\.[0-9]*\s*([eE][+-]?[0-9]+)?)\b'
name: constant.numeric.float.parigp
-
match: '\b([0-9]+)\b'
Expand Down
3 changes: 3 additions & 0 deletions src/operators.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ repository:
-
match: '(&&|\|\||!\b)'
name: keyword.operator.logical.parigp
-
match: '(\->)'
name: keyword.operator.lambda
-
match: '(<=|>=|<|>)'
name: keyword.operator.comparison.parigp
Expand Down
240 changes: 196 additions & 44 deletions tests/functions.test.gp

Large diffs are not rendered by default.

22 changes: 13 additions & 9 deletions tests/literals.test.gp
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
## SYNTAX TEST "source.parigp" "Literals"

1.23E-10
##^^^^^^^^ source.parigp constant.numeric.float
##^^^^^^^^ source.parigp constant.numeric.float.parigp

-123 + 043664.32
## ^^^ source.parigp constant.numeric.int
##. ^^^^^^^^^ source.parigp constant.numeric.float
-123 - .123E-07 + 043664.32
##^ ^ ^ source.parigp keyword.operator.arithmetic.parigp
## ^^^ source.parigp constant.numeric.int.parigp
## ^^^^^^^^ ^^^^^^^^^ source.parigp constant.numeric.float.parigp

00432
##^^^^^ source.parigp constant.numeric.int
##^^^^^ source.parigp constant.numeric.int.parigp

0x12A3F
##^^^^^^^ source.parigp constant.numeric.hex
##^^^^^^^ source.parigp constant.numeric.hex.parigp

0b00011001
##^^^^^^^^^^ source.parigp constant.numeric.bin
##^^^^^^^^^^ source.parigp constant.numeric.bin.parigp

"Hello, world!"
## ^^^^^^^^^^^^^ source.parigp constant.character.escape
## ^^^^^^^^^^^^^ source.parigp constant.character.escape.parigp

s = "Lorem_ipsum;"
## ^^^^^^^^^^^^^ source.parigp constant.character.escape
##^ source.parigp variable.name.parigp
## ^ ^ source.parigp constant.character.whitespace.parigp
## ^ source.parigp keyword.operator.assignment.parigp
## ^^^^^^^^^^^^^ source.parigp constant.character.escape.parigp
36 changes: 18 additions & 18 deletions tests/operators.test.gp
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
## SYNTAX TEST "source.parigp" "Operators"

(var! + 100!)
## ^ source.parigp keyword.operator.factorial
## ^ source.parigp keyword.operator.arithmetic
## ^ source.parigp keyword.operator.factorial
## ^ source.parigp keyword.operator.factorial.parigp
## ^ source.parigp keyword.operator.arithmetic.parigp
## ^ source.parigp keyword.operator.factorial.parigp

(1 && []) || (0 || "string")
## ^^ source.parigp keyword.operator.logical
## ^^ source.parigp keyword.operator.logical
## ^^ source.parigp keyword.operator.logical
## ^^ source.parigp keyword.operator.logical.parigp
## ^^ source.parigp keyword.operator.logical.parigp
## ^^ source.parigp keyword.operator.logical.parigp

if(!cond,,print("Bad!"));
## ^ source.parigp keyword.operator.logical
## ^ source.parigp keyword.operator.logical.parigp

(1 >= 1) && (10 <= 11) || (x > 0)
## ^^ source.parigp keyword.operator.comparison
## ^^ source.parigp keyword.operator.logical
## ^^ source.parigp keyword.operator.comparison
## ^^ source.parigp keyword.operator.logical
## ^ source.parigp keyword.operator.comparison
## ^^ source.parigp keyword.operator.comparison.parigp
## ^^ source.parigp keyword.operator.logical.parigp
## ^^ source.parigp keyword.operator.comparison.parigp
## ^^ source.parigp keyword.operator.logical.parigp
## ^ source.parigp keyword.operator.comparison.parigp

y < 0
## ^ source.parigp keyword.operator.comparison
## ^ source.parigp keyword.operator.comparison.parigp

x = 10;
## ^ source.parigp keyword.operator.assignment
## ^ source.parigp keyword.operator.assignment.parigp

[1..100]
## ^^ source.parigp keyword.operator.range
## ^^ source.parigp keyword.operator.range.parigp

[1, 2, 3; 4, 5, 6]~
## ^ source.parigp keyword.operator.transpose
## ^ source.parigp keyword.operator.transpose.parigp

[('x^2 + 1)', 1; 1, 'x]'
## ^ source.parigp keyword.operator.derivative
## ^ source.parigp keyword.operator.derivative
## ^ source.parigp keyword.operator.derivative.parigp
## ^ source.parigp keyword.operator.derivative.parigp

0 comments on commit cdb9cbb

Please sign in to comment.