diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2020-04-14 22:47:33 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2020-04-14 22:47:33 -0500 |
| commit | 25b07a07fff0c15ddae2610016289368fe41f3e2 (patch) | |
| tree | 0b4f73bd8efa034b2710cb88921d61c3bcf92ba9 /tests | |
| parent | 92fe90f834b1afc1098d4ed63760ca811ab48484 (diff) | |
| download | nimterop-25b07a07fff0c15ddae2610016289368fe41f3e2.tar.gz nimterop-25b07a07fff0c15ddae2610016289368fe41f3e2.zip | |
ast2 nested array field
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/include/tast2.h | 46 | ||||
| -rw-r--r-- | tests/tast2.nim | 49 |
2 files changed, 94 insertions, 1 deletions
diff --git a/tests/include/tast2.h b/tests/include/tast2.h index 136784a..fe78146 100644 --- a/tests/include/tast2.h +++ b/tests/include/tast2.h @@ -175,6 +175,29 @@ typedef struct { const char* const* x; } SomeType; +// Nested #137 +typedef struct { + struct NT1 { int f1; } f1; + struct { int f1; } f2; + + struct NT3 { + struct { + int f1; + union NU1 { + float f1; + } f2; + enum { NEV1, NEV2, NEV3 } f3; + } f1; + } f3; + + struct { int f1; } f4; + + union NU2 { int f1; } f5; + union { int f1; } f6; + enum NE1 { NEV4 = 8, NEV5 } f7; + enum { NEV6 = 8 * 8, NEV7 } f8; +} nested; + // DUPLICATES @@ -344,6 +367,29 @@ typedef struct { const char* const* x; } SomeType; +// Nested #137 +typedef struct { + struct NT1 { int f1; } f1; + struct { int f1; } f2; + + struct NT3 { + struct { + int f1; + union NU1 { + float f1; + } f2; + enum { NEV1, NEV2, NEV3 } f3; + } f1; + } f3; + + struct { int f1; } f4; + + union NU2 { int f1; } f5; + union { int f1; } f6; + enum NE1 { NEV4 = 8, NEV5 } f7; + enum { NEV6 = 8 * 8, NEV7 } f8; +} nested; + #endif diff --git a/tests/tast2.nim b/tests/tast2.nim index 6d749c6..46101d5 100644 --- a/tests/tast2.nim +++ b/tests/tast2.nim @@ -372,4 +372,51 @@ checkPragmas(AudioCVT, pHeaderBy, istype = false, "SDL_") # Issue #172 assert SomeType is object testFields(SomeType, "x!ptr cstring") -checkPragmas(SomeType, pHeaderImpBy)
\ No newline at end of file +checkPragmas(SomeType, pHeaderImpBy) + +# Nested #137 +assert NT1 is object +testFields(NT1, "f1!cint") +checkPragmas(NT1, pHeaderBy, istype = false) + +assert Type_tast2h1 is object +testFields(Type_tast2h1, "f1!cint") +checkPragmas(Type_tast2h1, pHeaderBy, istype = false) + +assert NU1 is object +testFields(NU1, "f1!cfloat") +checkPragmas(NU1, pHeaderBy & @["union"], istype = false) + +assert NEV1 == 0 +assert NEV2 == 1 +assert NEV3 == 2 + +assert Type_tast2h2 is object +testFields(Type_tast2h2, "f1|f2|f3!cint|NU1|Enum_tast2h1") +checkPragmas(Type_tast2h2, pHeaderBy, istype = false) + +assert NT3 is object +testFields(NT3, "f1!Type_tast2h2") +checkPragmas(NT3, pHeaderBy, istype = false) + +assert Type_tast2h3 is object +testFields(Type_tast2h3, "f1!cint") +checkPragmas(Type_tast2h3, pHeaderBy, istype = false) + +assert NU2 is object +testFields(NU2, "f1!cint") +checkPragmas(NU2, pHeaderBy & @["union"], istype = false) + +assert Union_tast2h1 is object +testFields(Union_tast2h1, "f1!cint") +checkPragmas(Union_tast2h1, pHeaderBy & @["union"], istype = false) + +assert NEV4 == 8 +assert NEV5 == 9 + +assert NEV6 == 64 +assert NEV7 == 65 + +assert nested is object +testFields(nested, "f1|f2|f3|f4|f5|f6|f7|f8!NT1|Type_tast2h1|NT3|Type_tast2h3|NU2|Union_tast2h1|NE1|Enum_tast2h2") +checkPragmas(nested, pHeaderImpBy)
\ No newline at end of file |
