diff options
author | Jason Beetham <beefers331@gmail.com> | 2022-10-21 22:37:23 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-22 06:37:23 +0200 |
commit | da0a2fdca20eb48f73fe72d777ec142674debed2 (patch) | |
tree | 41e91e75565320709c797e2968ccccef73e91bcb /tests/views/tconst_views.nim | |
parent | 0faae4d5e29ea4eb55f3b53b1f01b91637f2c6c7 (diff) | |
download | Nim-da0a2fdca20eb48f73fe72d777ec142674debed2.tar.gz |
Unpack mSlice tupleconstr for static openarrays (#20615)
Diffstat (limited to 'tests/views/tconst_views.nim')
-rw-r--r-- | tests/views/tconst_views.nim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/views/tconst_views.nim b/tests/views/tconst_views.nim index d7f1fc481..a85b03864 100644 --- a/tests/views/tconst_views.nim +++ b/tests/views/tconst_views.nim @@ -24,3 +24,14 @@ proc `$`(x: openArray[int]): string = echo c echo c2.data + +type MyObj = object + data: openarray[char] + +const + val1 = Foo(data: toOpenArray([1, 2, 3], 1, 1)) + val2 = Foo(data: toOpenArray([1, 2, 3], 0, 2)) + val3 = MyObj(data: "Hello".toOpenArray(0, 2)) +assert val1.data == [2] +assert val2.data == [1, 2, 3] +assert val3.data == "Hel" |