Skip to content

Commit

Permalink
declare enum and more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edemaine committed Feb 23, 2023
1 parent 8e42db5 commit bd6bc0d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/parser.hera
Original file line number Diff line number Diff line change
Expand Up @@ -5302,6 +5302,7 @@ TypeDeclarationRest
# NOTE: These are all guaranteed to be preceded by a `declare` keyword
TypeLexicalDeclaration
__ LetOrConstOrVar TypeDeclarationBinding ( CommaDelimiter __ TypeDeclarationBinding )*
__ EnumDeclaration
ClassSignature
Namespace TrailingComment* IdentifierName DeclareBlock
Module _ StringLiteral DeclareBlock?
Expand Down
17 changes: 17 additions & 0 deletions test/types/declare.civet
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ describe "[TS] declare", ->
}
"""

testCase """
declare enum
---
declare enum Direction
Up
Down
Left
Right
---
declare enum Direction {
Up,
Down,
Left,
Right,
}
"""

testCase """
declare namespace
---
Expand Down
29 changes: 29 additions & 0 deletions test/types/enum.civet
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,32 @@ describe "[TS] enum", ->
Direction[Direction["Right"] = 4] = "Right";

"""

testCase """
const enum
---
const enum Direction
Up
Down
Left
Right
---
const enum Direction {
Up,
Down,
Left,
Right,
}
"""

testCase.js """
const enum js
---
const enum Direction
Up
Down
Left
Right
---

"""

0 comments on commit bd6bc0d

Please sign in to comment.