aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.ucl/tests/array.cc
diff options
context:
space:
mode:
authorLexi Winter <lexi@le-fay.org>2025-06-22 23:25:26 +0100
committerLexi Winter <lexi@le-fay.org>2025-06-22 23:25:26 +0100
commit8cbb82a1f6eb6605a4615d30922b777e7bf1e4d8 (patch)
treec79559e81aa9570e22a13ec0439ff7eee05f9ffd /nihil.ucl/tests/array.cc
parent639b270eed81f7c2627d810057d188e2e8ee67f9 (diff)
downloadnihil-8cbb82a1f6eb6605a4615d30922b777e7bf1e4d8.tar.gz
nihil-8cbb82a1f6eb6605a4615d30922b777e7bf1e4d8.tar.bz2
nihil.ucl: add map<>
Diffstat (limited to 'nihil.ucl/tests/array.cc')
-rw-r--r--nihil.ucl/tests/array.cc14
1 files changed, 3 insertions, 11 deletions
diff --git a/nihil.ucl/tests/array.cc b/nihil.ucl/tests/array.cc
index ce86058..023b3bf 100644
--- a/nihil.ucl/tests/array.cc
+++ b/nihil.ucl/tests/array.cc
@@ -97,14 +97,8 @@ TEST_CASE("ucl: array: parse", "[ucl]")
using namespace std::literals;
using namespace nihil::ucl;
- auto input = "value = [1, 42, 666]"sv;
- auto obj = parse(input);
- auto v = obj.lookup("value");
-
- REQUIRE(v);
- REQUIRE(v->key() == "value");
-
- auto arr = object_cast<array<integer>>(*v);
+ auto obj = parse("value = [1, 42, 666]"sv);
+ auto arr = object_cast<array<integer>>(obj["value"]);
REQUIRE(arr.size() == 3);
REQUIRE(arr[0] == 1);
REQUIRE(arr[1] == 42);
@@ -170,9 +164,7 @@ TEST_CASE("ucl: array: heterogeneous elements", "[ucl]")
using namespace nihil::ucl;
auto obj = parse("array [ 42, true, \"test\" ];");
- auto v = obj.lookup("array");
- REQUIRE(v);
- auto arr = object_cast<array<>>(*v);
+ auto arr = object_cast<array<>>(obj["array"]);
REQUIRE(arr.size() == 3);