From 90a8d722ffd12fa77012e032bdd00657b74dfe37 Mon Sep 17 00:00:00 2001 From: Mingun Date: Wed, 17 Apr 2024 21:01:57 +0500 Subject: [PATCH] formats_err: add test for leaking types Tests for https://github.com/kaitai-io/kaitai_struct/issues/534 Adds new failing test in compliler: [info] - imports_type_leaking *** FAILED *** [info] [] [info] did not equal [info] [imports/type_two.ksy: /seq/0/type: [info] error: unable to find type 'type_one', searching from type_two [info] ] (SimpleMatchers.scala:34) --- formats_err/imports/type_one.ksy | 6 ++++++ formats_err/imports/type_two.ksy | 7 +++++++ formats_err/imports_type_leaking.ksy | 13 +++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 formats_err/imports/type_one.ksy create mode 100644 formats_err/imports/type_two.ksy create mode 100644 formats_err/imports_type_leaking.ksy diff --git a/formats_err/imports/type_one.ksy b/formats_err/imports/type_one.ksy new file mode 100644 index 000000000..89ab79a6d --- /dev/null +++ b/formats_err/imports/type_one.ksy @@ -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 \ No newline at end of file diff --git a/formats_err/imports/type_two.ksy b/formats_err/imports/type_two.ksy new file mode 100644 index 000000000..8ede7d42c --- /dev/null +++ b/formats_err/imports/type_two.ksy @@ -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 \ No newline at end of file diff --git a/formats_err/imports_type_leaking.ksy b/formats_err/imports_type_leaking.ksy new file mode 100644 index 000000000..e29f79d5e --- /dev/null +++ b/formats_err/imports_type_leaking.ksy @@ -0,0 +1,13 @@ +# 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 \ No newline at end of file