Skip to content

Commit

Permalink
feat: syntax tests!
Browse files Browse the repository at this point in the history
  • Loading branch information
novusnota committed May 29, 2024
1 parent e7f7cd0 commit a9a24cb
Show file tree
Hide file tree
Showing 13 changed files with 574 additions and 526 deletions.
36 changes: 20 additions & 16 deletions tests/syntax_test_const.tact
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
// SYNTAX TEST "Packages/Tact/package/Tact.tmLanguage"

const declared: String;
// <- keyword
// ^ constant
// ^ punctuation.delimiter
// ^ type.builtin
// ^ punctuation.delimiter
// <- keyword.other.tact
// ^^^^^^^^ variable.other.tact
// ^ punctuation.colon.tact
// ^^^^^^ entity.name.type.tact
// ^ punctuation.semi.tact

const DeclaredUppercase: String;
// <- keyword.other.tact
// ^^^^^^^^^^^^^^^^^ constant.other.caps.tact

override virtual abstract const theAnswer: Int = 42;
// <- keyword
// ^ keyword
// ^ keyword
// ^ keyword
// ^ constant
// ^ punctuation.delimiter
// ^ type.builtin
// ^ operator
// ^ number
// ^ punctuation.delimiter
// <- keyword.other.attribute.tact storage.modifier.tact
// ^^^^^^^ keyword.other.attribute.tact storage.modifier.tact
// ^^^^^^^^ keyword.other.attribute.tact storage.modifier.tact
// ^^^^^ keyword.other.tact
// ^^^^^^^^^ variable.other.tact
// ^ punctuation.colon.tact
// ^^^ entity.name.type.tact
// ^ keyword.operator.assignment.equal.tact
// ^^ constant.numeric.decimal.tact
// ^ punctuation.semi.tact

fun refTest(): Int {
return theAnswer + 0;
// ^ constant
// ^^^^^^^^^ variable.other.tact
}
38 changes: 19 additions & 19 deletions tests/syntax_test_contract.tact
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
// SYNTAX TEST "Packages/Tact/package/Tact.tmLanguage"

contract Empty {}
// <- keyword
// ^ variable
// ^ punctuation.bracket
// ^ punctuation.bracket
// <- keyword.other.contract.tact
// ^ entity.name.type.tact
// ^ punctuation.brackets.curly.tact
// ^ punctuation.brackets.curly.tact

contract Filled {
init() {}
// <- function
// ^ punctuation.bracket
// ^ punctuation.bracket
// ^ punctuation.bracket
// ^ punctuation.bracket
init() {}
// <- keyword.other.function.tact
// ^ punctuation.brackets.round.tact
// ^ punctuation.brackets.round.tact
// ^ punctuation.brackets.curly.tact
// ^ punctuation.brackets.curly.tact

receive() {}
// <- function
receive() {}
// <- keyword.other.function.tact

external() {}
// <- function
external() {}
// <- keyword.other.function.tact

bounced(msg: Slice) {}
// <- function
// ^ variable.parameter
// ^ punctuation.delimiter
// ^ type.builtin
bounced(msg: Slice) {}
// <- keyword.other.function.tact
// ^ variable.other.tact
// ^ punctuation.colon.tact
// ^ entity.name.type.tact
}
91 changes: 42 additions & 49 deletions tests/syntax_test_expression.tact
Original file line number Diff line number Diff line change
@@ -1,70 +1,63 @@
// SYNTAX TEST "Packages/Tact/package/Tact.tmLanguage"

fun c() {
false || true;
// <- constant.builtin
// ^ operator
// ^ constant.builtin
// ^ punctuation.delimiter
false || true;
// <- constant.language.bool.tact
// ^^ keyword.operator.logical.tact
// ^^^^ constant.language.bool.tact
// ^ punctuation.semi.tact

true && true;
// ^ operator
true && true;
// ^^ keyword.operator.logical.tact

true != true;
// ^ operator
true != true;
// ^^ keyword.operator.comparison.tact

true == true;
// ^ operator
true == true;
// ^^ keyword.operator.comparison.tact

2 > 1;
// ^ operator
2 > 1;
// ^ keyword.operator.comparison.tact

2 >= 2;
// ^ operator
2 >= 2;
// ^^ keyword.operator.comparison.tact

1 < 2;
// ^ operator
1 < 2;
// ^ keyword.operator.comparison.tact

2 <= 2;
// ^ operator
2 <= 2;
// ^^ keyword.operator.comparison.tact

5 >> 1;
// ^ operator
5 >> 1;
// ^^ keyword.operator.bitwise.tact

1 << 5;
// ^ operator
1 << 5;
// ^^ keyword.operator.bitwise.tact

0 ^ 1;
// ^ operator
0 ^ 1;
// ^ keyword.operator.bitwise.tact

0 & 1;
// ^ operator
0 & 1;
// ^ keyword.operator.bitwise.tact

0 | 1;
// ^ operator
0 | 1;
// ^ keyword.operator.bitwise.tact

0 + 1 - 2;
// ^ operator
// ^ operator
0 + 1 - 2;
// ^ keyword.operator.arithmetic.tact
// ^ keyword.operator.arithmetic.tact

0 * 1 / 5 % 10;
// ^ operator
// ^ operator
// ^ operator
0 * 1 / 5 % 10;
// ^ keyword.operator.arithmetic.tact
// ^ keyword.operator.arithmetic.tact
// ^ keyword.operator.arithmetic.tact

+0;
// <- operator
+0;
// <- keyword.operator.arithmetic.tact

-0;
// <- operator

!0;
// <- operator

null!!;
// ^ operator
-0;
// <- keyword.operator.arithmetic.tact

(0 );
// <- punctuation.bracket
// ^ punctuation.bracket
!0;
// <- keyword.operator.logical.tact
}
13 changes: 8 additions & 5 deletions tests/syntax_test_import.tact
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// SYNTAX TEST "Packages/Tact/package/Tact.tmLanguage"

import "@stdlib/deploy";
// <- keyword
// ^ string.special
// ^ punctuation.delimiter
// <- keyword.control.import.tact
// ^ string.quoted.double.tact punctuation.definition.string.begin.tact
// ^^^^^^^^^^^^^^ string.quoted.double.tact
// ^ string.quoted.double.tact punctuation.definition.string.end.tact
// ^ punctuation.semi.tact

// comment
// <- comment
// <- comment.line.double-slash.tact punctuation.definition.comment.line.double-slash.tact

/* multi-line comment/doc-string */
// <- comment
// <- comment.block.tact comment.block.begin.tact punctuation.definition.comment.begin.tact
// ^^ comment.block.tact comment.block.end.tact punctuation.definition.comment.end.tact
22 changes: 11 additions & 11 deletions tests/syntax_test_message.tact
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// SYNTAX TEST "Packages/Tact/package/Tact.tmLanguage"

message Empty {}
// <- keyword
// ^ type
// ^ punctuation.bracket
// ^ punctuation.bracket
// <- keyword.other.message.tact
// ^^^^^ entity.name.type.tact
// ^ punctuation.brackets.curly.tact
// ^ punctuation.brackets.curly.tact

message(0x42) WithValue {}
// <- keyword
// ^ punctuation.bracket
// ^ number
// ^ punctuation.bracket
// ^ type
// ^ punctuation.bracket
// ^ punctuation.bracket
// <- keyword.other.message.tact
// ^ punctuation.brackets.round.tact
// ^^^^ constant.numeric.hex.tact
// ^ punctuation.brackets.round.tact
// ^^^^^^^^^ entity.name.type.tact
// ^ punctuation.brackets.curly.tact
// ^ punctuation.brackets.curly.tact
42 changes: 22 additions & 20 deletions tests/syntax_test_native.tact
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
// SYNTAX TEST "Packages/Tact/package/Tact.tmLanguage"

@name(load_int)
// <- attribute
// ^ punctuation.bracket
// ^ function
// ^ punctuation.bracket
// <- entity.other.attribute-name.tact
// ^ punctuation.brackets.round.tact
// ^^^^^^^^ entity.name.function.func.tact
// ^ punctuation.brackets.round.tact

extends mutates native loadInt(self: Slice, l: Int, ): Int;
// <- keyword
// ^ keyword
// ^ keyword
// ^ function
// ^ punctuation.bracket
// ^ variable.parameter
// ^ punctuation.delimiter
// ^ type.builtin
// ^ variable.parameter
// ^ punctuation.delimiter
// ^ type.builtin
// ^ punctuation.delimiter
// ^ punctuation.bracket
// ^ punctuation.delimiter
// ^ type.builtin
// ^ punctuation.delimiter
// <- keyword.other.attribute.tact
// ^^^^^^^ keyword.other.attribute.tact
// ^^^^^^ keyword.other.function.tact
// ^^^^^^^ entity.name.function.tact
// ^ punctuation.brackets.round.tact
// ^^^^ variable.language.this.tact
// ^ punctuation.colon.tact
// ^^^^^ entity.name.type.tact
// ^ punctuation.comma.tact
// ^ variable.other.tact
// ^ punctuation.colon.tact
// ^^^ entity.name.type.tact
// ^ punctuation.comma.tact
// ^ punctuation.brackets.round.tact
// ^ punctuation.colon.tact
// ^^^ entity.name.type.tact
// ^ punctuation.semi.tact
Loading

0 comments on commit a9a24cb

Please sign in to comment.