Skip to content

Commit 6e58a53

Browse files
author
Steve Hanson
committed
fix coverage
1 parent 3987d82 commit 6e58a53

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

test/unittest/pointertest.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Tencent is pleased to support the open source community by making RapidJSON available.
22
//
33
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip.
4+
// Portions (C) Copyright IBM Corporation 2021
45
//
56
// Licensed under the MIT License (the "License"); you may not use this file except
67
// in compliance with the License. You may obtain a copy of the License at
@@ -676,14 +677,15 @@ TEST(Pointer, GetUri) {
676677
EXPECT_TRUE((Pointer("/jbo").GetUri(d, Pointer::UriType(doc)).Get()) == "http://doc/root/");
677678
EXPECT_TRUE((Pointer("/jbo/child").GetUri(d, Pointer::UriType(doc)).Get()) == "http://doc/root/"); // id not string
678679

680+
EXPECT_TRUE((Pointer("/abc").GetUri(d, Pointer::UriType(doc)).Get()) == Pointer::UriType().Get()); // Out of boundary
679681
size_t unresolvedTokenIndex;
680-
EXPECT_TRUE((Pointer("/foo/3").GetUri(d, Pointer::UriType(doc), &unresolvedTokenIndex).Get()) == ""); // Out of boundary
682+
EXPECT_TRUE((Pointer("/foo/3").GetUri(d, Pointer::UriType(doc), &unresolvedTokenIndex).Get()) == Pointer::UriType().Get()); // Out of boundary
681683
EXPECT_EQ(1u, unresolvedTokenIndex);
682-
EXPECT_TRUE((Pointer("/foo/a").GetUri(d, Pointer::UriType(doc), &unresolvedTokenIndex).Get()) == ""); // "/foo" is an array, cannot query by "a"
684+
EXPECT_TRUE((Pointer("/foo/a").GetUri(d, Pointer::UriType(doc), &unresolvedTokenIndex).Get()) == Pointer::UriType().Get()); // "/foo" is an array, cannot query by "a"
683685
EXPECT_EQ(1u, unresolvedTokenIndex);
684-
EXPECT_TRUE((Pointer("/foo/0/0").GetUri(d, Pointer::UriType(doc), &unresolvedTokenIndex).Get()) == ""); // "/foo/0" is an string, cannot further query
686+
EXPECT_TRUE((Pointer("/foo/0/0").GetUri(d, Pointer::UriType(doc), &unresolvedTokenIndex).Get()) == Pointer::UriType().Get()); // "/foo/0" is an string, cannot further query
685687
EXPECT_EQ(2u, unresolvedTokenIndex);
686-
EXPECT_TRUE((Pointer("/foo/0/a").GetUri(d, Pointer::UriType(doc), &unresolvedTokenIndex).Get()) == ""); // "/foo/0" is an string, cannot further query
688+
EXPECT_TRUE((Pointer("/foo/0/a").GetUri(d, Pointer::UriType(doc), &unresolvedTokenIndex).Get()) == Pointer::UriType().Get()); // "/foo/0" is an string, cannot further query
687689
EXPECT_EQ(2u, unresolvedTokenIndex);
688690

689691
Pointer::Token tokens[] = { { "foo ...", 3, kPointerInvalidIndex } };
@@ -706,7 +708,8 @@ TEST(Pointer, Get) {
706708
EXPECT_EQ(&d["k\"l"], Pointer("/k\"l").Get(d));
707709
EXPECT_EQ(&d[" "], Pointer("/ ").Get(d));
708710
EXPECT_EQ(&d["m~n"], Pointer("/m~0n").Get(d));
709-
EXPECT_TRUE(Pointer("/abc").Get(d) == 0);
711+
712+
EXPECT_TRUE(Pointer("/abc").Get(d) == 0); // Out of boundary
710713
size_t unresolvedTokenIndex;
711714
EXPECT_TRUE(Pointer("/foo/2").Get(d, &unresolvedTokenIndex) == 0); // Out of boundary
712715
EXPECT_EQ(1u, unresolvedTokenIndex);

0 commit comments

Comments
 (0)