Skip to content

Commit

Permalink
formats_err: add test for leaking types
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_type_leaking *** FAILED ***
[info]   []
[info]     did not equal
[info]   [..\tests\formats_err/imports/type_two.ksy: /seq/0/type:
[info]          error: unable to find type 'type_one', searching from type_two
[info]   ] (SimpleMatchers.scala:34)
  • Loading branch information
Mingun committed Apr 17, 2024
1 parent ede1105 commit 9f2a694
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions formats_err/imports/type_one.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This is a file that is imported in imports_type_leaking.ksy
meta:
id: type_one
seq:
- id: something
size: 4
7 changes: 7 additions & 0 deletions formats_err/imports/type_two.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This is a file that is imported in imports_type_leaking.ksy
meta:
id: type_two
# Note: missing import of `type_one`
seq:
- id: one
type: type_one # Note: `type_one` is not imported in this spec, so this should cause a compile error
13 changes: 13 additions & 0 deletions formats_err/imports_type_leaking.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ..\tests\formats_err/imports/type_two.ksy: /seq/0/type:
# error: unable to find type 'type_one', searching from type_two
#
meta:
id: imports_type_leaking
imports:
- imports/type_one
- imports/type_two
seq:
- id: another_one
type: type_one
- id: another_two
type: type_two

0 comments on commit 9f2a694

Please sign in to comment.