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.
Ensure that
contents
and valid
apply to individual elements
Resolves kaitai-io/kaitai_struct#1117 This is how the `contents` key worked until KS 0.8, but then in KS 0.9, `contents` started to be converted to the newly introduced `valid`, which was applied only once at the end on the final value. This means that it was applied on the entire array in the case of repeated fields. However, the behavior of `valid` + `repeat` wasn't tested anywhere, so I think it was an oversight. Note that the Kaitai Struct language doesn't define an equality `==` operation for true arrays, so it wouldn't even work. Running the `valid` and `contents` checks on each element is more flexible (and also seems more useful). Fixes the following tests for all languages except Go (will be fixed in the following commit), Nim, Perl and Construct: * ValidFailRepeatAnyofInt * ValidFailRepeatContents * ValidFailRepeatEqInt * ValidFailRepeatExpr * ValidFailRepeatInst * ValidFailRepeatMaxInt * ValidFailRepeatMinInt These tests were added in kaitai-io/kaitai_struct_tests@98a68fc
- Loading branch information
1 parent
06f5658
commit 7154301
Showing
3 changed files
with
34 additions
and
21 deletions.
There are no files selected for viewing
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