Skip to content

Commit

Permalink
formats_err: add test for leaking enums
Browse files Browse the repository at this point in the history
Tests for kaitai-io/kaitai_struct#534

Adds new failing test in compliler:

[info] - imports_enum_leaking *** FAILED ***
[info]   []
[info]     did not equal
[info]   [imports/enum_two.ksy: /seq/0/enum:
[info]          error: unable to find enum 'enum_one::one', searching from enum_two
[info]   ] (SimpleMatchers.scala:34)
  • Loading branch information
Mingun committed Apr 18, 2024
1 parent 90a8d72 commit 58ce2fe
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
10 changes: 10 additions & 0 deletions formats_err/imports/enum_one.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This is a file that is imported in imports_enum_leaking.ksy
meta:
id: enum_one
seq:
- id: something
type: u1
enum: one
enums:
one:
0: zero
11 changes: 11 additions & 0 deletions formats_err/imports/enum_two.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This is a file that is imported in imports_enum_leaking.ksy
meta:
id: enum_two
# Note: missing import of `enum_one`
seq:
- id: one
type: u1
enum: enum_one::one # Note: `enum_one` is not imported in this spec, so this should cause a compile error
enums:
two:
0: zero
15 changes: 15 additions & 0 deletions formats_err/imports_enum_leaking.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# imports/enum_two.ksy: /seq/0/enum:
# error: unable to find enum 'enum_one::one', searching from enum_two
#
meta:
id: imports_enum_leaking
imports:
- imports/enum_one
- imports/enum_two
seq:
- id: another_one
type: u1
enum: enum_one::one
- id: another_two
type: u1
enum: enum_two::two

0 comments on commit 58ce2fe

Please sign in to comment.