harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 89b9ea45740af4ebc44b1ae8df388a600f83e5e7
parent 15e69825a57a52baceccb096ca1c292980a2a574
Author: Alexey Yerin <yyp@disroot.org>
Date:   Sat, 15 Jan 2022 11:10:44 +0300

tests/11-globals: import padding test case from #549

In 15e6982, the issue was fixed, but I didn't add a test for it.

Signed-off-by: Alexey Yerin <yyp@disroot.org>

Diffstat:
Mtests/11-globals.ha | 33+++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+), 0 deletions(-)

diff --git a/tests/11-globals.ha b/tests/11-globals.ha @@ -77,6 +77,38 @@ fn tagged() void = { // TODO: subset-compat }; +// Real-world sample + +type basic = enum { + FN, + FOR, + IF, + IN, + NOT, + SWITCH, + WHILE, +}; + +const keywords: [_](str, basic) = [ + ("fn", basic::FN), + ("for", basic::FOR), + ("if", basic::IF), + ("in", basic::IN), + ("not", basic::NOT), + ("switch", basic::SWITCH), + ("while", basic::WHILE), +]; + +fn tuplearray() void = { + assert(keywords[0].0 == "fn"); + assert(keywords[1].0 == "for"); + assert(keywords[2].0 == "if"); + assert(keywords[3].0 == "in"); + assert(keywords[4].0 == "not"); + assert(keywords[5].0 == "switch"); + assert(keywords[6].0 == "while"); +}; + export fn main() void = { // TODO: Expand this test: // - Declare & validate globals of more types @@ -86,4 +118,5 @@ export fn main() void = { invariants(); static_binding(); pointers(); + tuplearray(); };