Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formats_err: add tests for issue #534 #124

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion formats_err/enum_unknown_inst_value.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# enum_unknown_inst_value.ksy: /instances/should_fail/enum:
# error: unable to find enum 'animal', searching from enum_unknown_inst_value
# error: unable to find enum 'animal', searching from 'enum_unknown_inst_value'
#
meta:
id: enum_unknown_inst_value
Expand Down
2 changes: 1 addition & 1 deletion formats_err/enum_unknown_seq.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# enum_unknown_seq.ksy: /seq/0/enum:
# error: unable to find enum 'animal', searching from enum_unknown_seq
# error: unable to find enum 'animal', searching from 'enum_unknown_seq'
#
meta:
id: enum_unknown_seq
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_cast_type_unknown.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_cast_type_unknown.ksy: /instances/foo_bar/value:
# error: unable to find type 'bar', searching from expr_cast_type_unknown
# error: unable to find type 'bar', searching from 'expr_cast_type_unknown'
#
meta:
id: expr_cast_type_unknown
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_compare_enum2.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_compare_enum2.ksy: /seq/1/if:
# error: can't compare EnumType(List(animal),Int1Type(false)) and Int1Type(true)
# error: can't compare EnumType(EnumRef(false,List(),animal),Int1Type(false)) and Int1Type(true)
#
meta:
id: expr_compare_enum2
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_enum_unknown.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_enum_unknown.ksy: /seq/1/if:
# error: unable to find enum 'unknown_enum', searching from expr_enum_unknown
# error: unable to find enum 'unknown_enum', searching from 'expr_enum_unknown'
#
meta:
id: expr_enum_unknown
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_field_unknown_endian_switch_cases.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_field_unknown_endian_switch_cases.ksy: /meta/endian/cases/Name(identifier(qux)):
# error: unable to access 'qux' in expr_field_unknown_endian_switch_cases context
# error: unable to access 'qux' in 'expr_field_unknown_endian_switch_cases' context
#
meta:
id: expr_field_unknown_endian_switch_cases
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_field_unknown_endian_switch_on.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_field_unknown_endian_switch_on.ksy: /meta/endian/switch-on:
# error: unable to access 'qux' in expr_field_unknown_endian_switch_on context
# error: unable to access 'qux' in 'expr_field_unknown_endian_switch_on' context
#
meta:
id: expr_field_unknown_endian_switch_on
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_field_unknown_if_inst_pos.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_field_unknown_if_inst_pos.ksy: /instances/foo/if:
# error: unable to access 'bar' in expr_field_unknown_if_inst_pos context
# error: unable to access 'bar' in 'expr_field_unknown_if_inst_pos' context
#
meta:
id: expr_field_unknown_if_inst_pos
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_field_unknown_if_inst_value.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_field_unknown_if_inst_value.ksy: /instances/foo/if:
# error: unable to access 'bar' in expr_field_unknown_if_inst_value context
# error: unable to access 'bar' in 'expr_field_unknown_if_inst_value' context
#
meta:
id: expr_field_unknown_if_inst_value
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_field_unknown_if_seq.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_field_unknown_if_seq.ksy: /seq/0/if:
# error: unable to access 'bar' in expr_field_unknown_if_seq context
# error: unable to access 'bar' in 'expr_field_unknown_if_seq' context
#
meta:
id: expr_field_unknown_if_seq
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_field_unknown_inst_value_enum.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_field_unknown_inst_value_enum.ksy: /instances/foo/value:
# error: unable to access 'bar' in expr_field_unknown_inst_value_enum context
# error: unable to access 'bar' in 'expr_field_unknown_inst_value_enum' context
#
meta:
id: expr_field_unknown_inst_value_enum
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_field_unknown_params_call.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_field_unknown_params_call.ksy: /seq/0/type:
# error: unable to access 'bar' in expr_field_unknown_params_call context
# error: unable to access 'bar' in 'expr_field_unknown_params_call' context
#
meta:
id: expr_field_unknown_params_call
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_field_unknown_switch_cases.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_field_unknown_switch_cases.ksy: /seq/1/type/cases/Name(identifier(ahem)):
# error: unable to access 'ahem' in expr_field_unknown_switch_cases context
# error: unable to access 'ahem' in 'expr_field_unknown_switch_cases' context
#
meta:
id: expr_field_unknown_switch_cases
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_field_unknown_switch_on.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_field_unknown_switch_on.ksy: /seq/0/type/switch-on:
# error: unable to access 'bar' in expr_field_unknown_switch_on context
# error: unable to access 'bar' in 'expr_field_unknown_switch_on' context
#
meta:
id: expr_field_unknown_switch_on
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_field_unknown_switch_params_call.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_field_unknown_switch_params_call.ksy: /seq/0/type/cases/Bool(true):
# error: unable to access 'bar' in expr_field_unknown_switch_params_call context
# error: unable to access 'bar' in 'expr_field_unknown_switch_params_call' context
#
meta:
id: expr_field_unknown_switch_params_call
Expand Down
4 changes: 2 additions & 2 deletions formats_err/expr_field_unknown_valid_any_of.ksy
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# expr_field_unknown_valid_any_of.ksy: /seq/0/valid/any-of/1:
# error: unable to access 'bar' in expr_field_unknown_valid_any_of context
# error: unable to access 'bar' in 'expr_field_unknown_valid_any_of' context
#
# expr_field_unknown_valid_any_of.ksy: /seq/0/valid/any-of/3:
# error: unable to access 'qux' in expr_field_unknown_valid_any_of context
# error: unable to access 'qux' in 'expr_field_unknown_valid_any_of' context
#
meta:
id: expr_field_unknown_valid_any_of
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_field_unknown_valid_eq_long.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_field_unknown_valid_eq_long.ksy: /seq/0/valid/eq:
# error: unable to access 'bar' in expr_field_unknown_valid_eq_long context
# error: unable to access 'bar' in 'expr_field_unknown_valid_eq_long' context
#
meta:
id: expr_field_unknown_valid_eq_long
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_field_unknown_valid_eq_short.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_field_unknown_valid_eq_short.ksy: /seq/0/valid:
# error: unable to access 'bar' in expr_field_unknown_valid_eq_short context
# error: unable to access 'bar' in 'expr_field_unknown_valid_eq_short' context
#
meta:
id: expr_field_unknown_valid_eq_short
Expand Down
2 changes: 1 addition & 1 deletion formats_err/expr_field_unknown_valid_expr.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expr_field_unknown_valid_expr.ksy: /seq/0/valid/expr:
# error: unable to access 'bar' in expr_field_unknown_valid_expr context
# error: unable to access 'bar' in 'expr_field_unknown_valid_expr' context
#
meta:
id: expr_field_unknown_valid_expr
Expand Down
4 changes: 2 additions & 2 deletions formats_err/expr_field_unknown_valid_range.ksy
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# expr_field_unknown_valid_range.ksy: /seq/0/valid/min:
# error: unable to access 'bar' in expr_field_unknown_valid_range context
# error: unable to access 'bar' in 'expr_field_unknown_valid_range' context
#
# expr_field_unknown_valid_range.ksy: /seq/0/valid/max:
# error: unable to access 'qux' in expr_field_unknown_valid_range context
# error: unable to access 'qux' in 'expr_field_unknown_valid_range' context
#
meta:
id: expr_field_unknown_valid_range
Expand Down
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
16 changes: 16 additions & 0 deletions formats_err/imports/enum_two.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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
instances:
# Enum resolution in value instances significantly different from enum resolution in other attributes
instance_one:
value: 0
enum: enum_one::one # Note: `enum_one` is not imported in this spec, so this should cause a compile error
enums:
two:
0: zero
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
25 changes: 25 additions & 0 deletions formats_err/imports_enum_leaking.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# imports/enum_two.ksy: /seq/0/enum:
# error: unable to find type 'enum_one', searching from 'enum_two'
#
# imports/enum_two.ksy: /instances/instance_one/enum:
# error: unable to find type 'enum_one', searching from 'enum_two'
#
Comment on lines +1 to +6
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange, but the second error never reported in this test, even when I apply kaitai-io/kaitai_struct_compiler#313, so all errors should be reported. Don't figure yet, why

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
instances:
instance_one:
value: 0
enum: enum_one::one
instance_two:
value: 0
enum: enum_two::two
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 @@
# 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
2 changes: 1 addition & 1 deletion formats_err/params_def_type_unknown.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# params_def_type_unknown.ksy: /params/0/type:
# error: unable to find type 'bar', searching from params_def_type_unknown
# error: unable to find type 'bar', searching from 'params_def_type_unknown'
#
meta:
id: params_def_type_unknown
Expand Down
2 changes: 1 addition & 1 deletion formats_err/type_unknown.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# type_unknown.ksy: /seq/0/type:
# error: unable to find type 'some_unknown_name', searching from type_unknown
# error: unable to find type 'some_unknown_name', searching from 'type_unknown'
#
meta:
id: type_unknown
Expand Down
19 changes: 16 additions & 3 deletions formats_err/type_unknown_many.ksy
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# type_unknown_many.ksy: /seq/0/type:
# error: unable to find type 'some_unknown_name', searching from type_unknown_many
# error: unable to find type 'some_unknown_name', searching from 'type_unknown_many'
#
# type_unknown_many.ksy: /seq/1/type:
# error: unable to find type 'also_unknown_name', searching from type_unknown_many
# error: unable to find type 'also_unknown_name', searching from 'type_unknown_many'
#
# type_unknown_many.ksy: /seq/2/enum:
# error: unable to find enum 'unknown_enum', searching from type_unknown_many
# error: unable to find enum 'unknown_enum', searching from 'type_unknown_many'
#
# type_unknown_many.ksy: /seq/3/type:
# error: unable to find type 'unknown_type_in_array', searching from 'type_unknown_many'
#
# type_unknown_many.ksy: /seq/4/enum:
# error: unable to find enum 'unknown_enum_in_array', searching from 'type_unknown_many'
#
meta:
id: type_unknown_many
Expand All @@ -18,3 +24,10 @@ seq:
- id: baz
type: u1
enum: unknown_enum
- id: type_in_array
type: unknown_type_in_array
repeat: eos
- id: enum_in_array
type: u1
enum: unknown_enum_in_array
repeat: eos
2 changes: 1 addition & 1 deletion formats_err/type_unknown_switch.ksy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# type_unknown_switch.ksy: /seq/0/type/cases/IntNum(42):
# error: unable to find type 'some_unknown_name', searching from type_unknown_switch
# error: unable to find type 'some_unknown_name', searching from 'type_unknown_switch'
#
meta:
id: type_unknown_switch
Expand Down