Skip to content

Commit

Permalink
fromYAML tests
Browse files Browse the repository at this point in the history
cleanup test logic

don't ignore whole classes of tests
  • Loading branch information
Philipp Otterbein committed Sep 17, 2024
1 parent 978b642 commit 18df60b
Show file tree
Hide file tree
Showing 3 changed files with 469 additions and 385 deletions.
39 changes: 36 additions & 3 deletions src/libexpr/tests/compose-yaml-test-suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ for f in "$1"/src/*.yaml; do
testname="$(basename ${f} .yaml)"
echo "static constexpr std::string_view T_${testname} = R\"RAW("
cat ${f}
case $testname in
4ABK)
cat << EOL
json: |
{
"unquoted": "separate",
"http://foo.com": null,
"omitted value": null
}
EOL
;;
SM9W)
# not JSON compatible due to null key
echo " fail: true"
;;
*)
;;
esac
echo ")RAW\";"
echo
done
Expand All @@ -29,15 +47,30 @@ echo
echo "namespace nix {"
for f in "$1"/src/*.yaml; do
testname="$(basename ${f} .yaml)"
[[ "${testname}" = "2SXE" ]] && echo " /** This test case is ignored because the YAML string is parsed incorrectly by ryml, but it's a rather artificial case, which isn't valid YAML 1.3 either."
ignore="false"
skip="false"
case $testname in
H7TQ | MUS6 | ZYU8)
echo " /** This test is ignored because these tests are not required to fail and rapidyaml ignores the YAML version string."
ignore="true"
;;
3HFZ | 4EJS | 5TRB | 5U3A | 7LBH | 9C9N | 9MQT | CVW2 | CXX2 | D49Q | DK4H | DK95 | G5U8 | JKF3 | N782 | QB6E | QLJ7 | RXY3 | S4GJ | S98Z | SY6V | VJP3 | X4QW | Y79Y | YJV2 | ZCZ6 | ZL4Z | ZXT5 | 3HFZ | 4EJS | 5TRB | 5U3A | 7LBH | 9C9N | 9MQT | CVW2 | CXX2 | D49Q | DK4H | DK95 | G5U8 | JKF3 | N782 | QB6E | QLJ7 | RXY3 | S4GJ | S98Z | SY6V | VJP3 | X4QW | Y79Y | YJV2 | ZCZ6 | ZL4Z | ZXT5)
skip="true"
;;
*)
;;
esac
echo " TEST_F(${testclass}, T_${testname}) {"
if [ "${testname}" = "565N" ]; then
echo " ASSERT_THROW(${testmethod}(T_${testname}),EvalError); // nix has no binary data type"
else
echo " ASSERT_EQ(${testmethod}(T_${testname}),\"OK\");"
if [ "${skip}" = "true" ]; then
echo " GTEST_SKIP() << \"Reason: Invalid yaml is parsed successfully\";"
fi
echo " ${testmethod}(T_${testname});"
fi
echo " }"
[[ "${testname}" = "2SXE" ]] && echo " */"
[[ "${ignore}" = "true" ]] && echo " */"
echo
done
echo "} /* namespace nix */"
Loading

0 comments on commit 18df60b

Please sign in to comment.