forked from kaitai-io/kaitai_struct_compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support of absolute paths for enums on parse level
- Loading branch information
Showing
12 changed files
with
116 additions
and
38 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
jvm/src/test/scala/io/kaitai/struct/exprlang/EnumRefSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package io.kaitai.struct.exprlang | ||
|
||
import org.scalatest.funspec.AnyFunSpec | ||
import org.scalatest.matchers.should.Matchers._ | ||
|
||
class EnumRefSpec extends AnyFunSpec { | ||
describe("Expressions.parseEnumRef") { | ||
describe("parses local enum refs") { | ||
it("some_enum") { | ||
Expressions.parseEnumRef("some_enum") should be(Ast.EnumRef( | ||
false, Seq(), "some_enum" | ||
)) | ||
} | ||
it("with spaces: ' some_enum '") { | ||
Expressions.parseEnumRef(" some_enum ") should be(Ast.EnumRef( | ||
false, Seq(), "some_enum" | ||
)) | ||
} | ||
|
||
it("::some_enum") { | ||
Expressions.parseEnumRef("::some_enum") should be(Ast.EnumRef( | ||
true, Seq(), "some_enum" | ||
)) | ||
} | ||
it("with spaces: ' :: some_enum '") { | ||
Expressions.parseEnumRef(" :: some_enum ") should be(Ast.EnumRef( | ||
true, Seq(), "some_enum" | ||
)) | ||
} | ||
} | ||
|
||
describe("parses path enum refs") { | ||
it("some::enum") { | ||
Expressions.parseEnumRef("some::enum") should be(Ast.EnumRef( | ||
false, Seq("some"), "enum" | ||
)) | ||
} | ||
it("with spaces: ' some :: enum '") { | ||
Expressions.parseEnumRef(" some :: enum ") should be(Ast.EnumRef( | ||
false, Seq("some"), "enum" | ||
)) | ||
} | ||
|
||
it("::some::enum") { | ||
Expressions.parseEnumRef("::some::enum") should be(Ast.EnumRef( | ||
true, Seq("some"), "enum" | ||
)) | ||
} | ||
it("with spaces: ' :: some :: enum '") { | ||
Expressions.parseEnumRef(" :: some :: enum ") should be(Ast.EnumRef( | ||
true, Seq("some"), "enum" | ||
)) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters