add test for non-null-terminated token 1567/head
authorEtienne Laurin <etienne.laurin@gonitro.com>
Thu, 12 Sep 2019 07:12:06 +0000 (08:12 +0100)
committerEtienne Laurin <etienne.laurin@gonitro.com>
Thu, 12 Sep 2019 07:12:06 +0000 (08:12 +0100)
test/unittest/pointertest.cpp

index 858fd2a..4629f76 100644 (file)
@@ -674,6 +674,9 @@ TEST(Pointer, Get) {
     EXPECT_EQ(2u, unresolvedTokenIndex);
     EXPECT_TRUE(Pointer("/foo/0/a").Get(d, &unresolvedTokenIndex) == 0); // "/foo/0" is an string, cannot further query
     EXPECT_EQ(2u, unresolvedTokenIndex);
+
+    Pointer::Token tokens[] = { { "foo ...", 3, kPointerInvalidIndex } };
+    EXPECT_EQ(&d["foo"], Pointer(tokens, 1).Get(d));
 }
 
 TEST(Pointer, GetWithDefault) {