Skip to content

Commit d192e36

Browse files
committed
failObj4_test
1 parent 9dfa737 commit d192e36

3 files changed

Lines changed: 47 additions & 42 deletions

File tree

test/assets/failObj4_test.hjson

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
a: 1
2+
b: 2
3+
# trailing bracket in bracketless root
4+
}

test/assets/testlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ failMLStr1_test.hjson
4444
failObj1_test.hjson
4545
failObj2_test.hjson
4646
failObj3_test.hjson
47+
failObj4_test.hjson
4748
failStr1a_test.hjson
4849
failStr1b_test.hjson
4950
failStr1c_test.hjson

test/test_value.cpp

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,6 @@ static std::string _test_string_param(std::string param) {
1212

1313

1414
void test_value() {
15-
{
16-
int a = 0;
17-
char *szBrackets = new char[2001];
18-
for (; a < 1000; a++) {
19-
szBrackets[a] = '[';
20-
}
21-
for (; a < 2000; a++) {
22-
szBrackets[a] = ']';
23-
}
24-
szBrackets[2000] = 0;
25-
Hjson::Unmarshal(szBrackets);
26-
delete[] szBrackets;
27-
}
28-
29-
{
30-
Hjson::Value node;
31-
node["a"] = 1;
32-
{
33-
Hjson::Value root;
34-
root["n"] = node;
35-
}
36-
assert(node.size() == 1);
37-
}
38-
39-
{
40-
Hjson::Value node;
41-
node["a"] = 1;
42-
node["a2"] = 2;
43-
{
44-
Hjson::Value node2;
45-
node2["b"] = node;
46-
node2["c"] = "alfa";
47-
node2["d"] = Hjson::Value(Hjson::Type::Undefined);
48-
{
49-
Hjson::Value root;
50-
root["n"] = node2;
51-
}
52-
assert(node2.size() == 3);
53-
}
54-
assert(node.size() == 2);
55-
}
56-
5715
{
5816
Hjson::Value valVec(Hjson::Type::Vector);
5917
assert(valVec.type() == Hjson::Type::Vector);
@@ -656,6 +614,48 @@ void test_value() {
656614
assert(root["key1"]["key2"]["key3"]["B"] == 5);
657615
}
658616

617+
{
618+
int a = 0;
619+
char *szBrackets = new char[2001];
620+
for (; a < 1000; a++) {
621+
szBrackets[a] = '[';
622+
}
623+
for (; a < 2000; a++) {
624+
szBrackets[a] = ']';
625+
}
626+
szBrackets[2000] = 0;
627+
Hjson::Unmarshal(szBrackets);
628+
delete[] szBrackets;
629+
}
630+
631+
{
632+
Hjson::Value node;
633+
node["a"] = 1;
634+
{
635+
Hjson::Value root;
636+
root["n"] = node;
637+
}
638+
assert(node.size() == 1);
639+
}
640+
641+
{
642+
Hjson::Value node;
643+
node["a"] = 1;
644+
node["a2"] = 2;
645+
{
646+
Hjson::Value node2;
647+
node2["b"] = node;
648+
node2["c"] = "alfa";
649+
node2["d"] = Hjson::Value(Hjson::Type::Undefined);
650+
{
651+
Hjson::Value root;
652+
root["n"] = node2;
653+
}
654+
assert(node2.size() == 3);
655+
}
656+
assert(node.size() == 2);
657+
}
658+
659659
{
660660
Hjson::Value val;
661661
try {

0 commit comments

Comments
 (0)