Skip to content

Commit

Permalink
Add ValidFailInEnum
Browse files Browse the repository at this point in the history
  • Loading branch information
generalmimon committed Aug 19, 2024
1 parent 53ca28f commit f0924b4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions formats/valid_fail_in_enum.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
meta:
id: valid_fail_in_enum
endian: le
seq:
- id: foo
type: u4
enum: animal
valid: # there is actually 7 in the file
in-enum: true
enums:
animal:
4: dog
12: chicken
11 changes: 11 additions & 0 deletions spec/ks/valid_fail_in_enum.kst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
id: valid_fail_in_enum
data: enum_0.bin
# NOTE: `s4` is not correct here. It should be the `valid_fail_in_enum::animal`
# enum. However, if we specified it as
# `ValidationNotInEnumError<valid_fail_in_enum::animal>`, KSC would think it's a
# user-defined type and throw an error, because such user type doesn't exist.
#
# The type argument is only relevant to C++, though, so we pass `s4` here just
# to pass something and the generated C++ test specs will have to be fixed
# manually.
exception: ValidationNotInEnumError<s4>

0 comments on commit f0924b4

Please sign in to comment.