From 9832f887e1772e1c0f546371584be323ae440fb8 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 9 Oct 2024 01:47:43 -0600 Subject: Add system to spec for running integration shell scirpts. The spec will recursively go through the test directories and look for `test.sh` files. If it finds one, it will run it. If the script returns 0, then the test passes, otherwise the test fails. --- test/integrations/anonymous_parsed/input.fdl | 11 +++++++++++ test/integrations/anonymous_parsed/test.sh | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 test/integrations/anonymous_parsed/input.fdl create mode 100755 test/integrations/anonymous_parsed/test.sh (limited to 'test/integrations') diff --git a/test/integrations/anonymous_parsed/input.fdl b/test/integrations/anonymous_parsed/input.fdl new file mode 100644 index 0000000..316c631 --- /dev/null +++ b/test/integrations/anonymous_parsed/input.fdl @@ -0,0 +1,11 @@ +package fiddle.test { + type test_type : struct { + reg test_reg(32) : struct { + test_bits : enum (1) { + on = 0b1, + off = 0b0, + }; + reserved(31); + }; + }; +}; diff --git a/test/integrations/anonymous_parsed/test.sh b/test/integrations/anonymous_parsed/test.sh new file mode 100755 index 0000000..9bcb6a6 --- /dev/null +++ b/test/integrations/anonymous_parsed/test.sh @@ -0,0 +1,17 @@ +#!/bin/bash +source "$(git rev-parse --show-toplevel)/test/integrations/common.sh" + +output=$( + stack run -- --dump-parsed input.fdl | + jq '.. + | objects + | select(._con == "RegisterBitsAnonymousType") + | .anonBitsType + .anonEnumBody[0] + .enumConsts[0] + .directedSubtree + .enumConstIdent') + +assert_eq "$output" '"on"' + +finish -- cgit