Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
ad053ef0
Commit
ad053ef0
authored
Aug 30, 2018
by
Ben Berman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests for improved error 305(hopefully)
parent
bbdfe7de
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
39 deletions
+39
-39
test/src/unit-element_access1.cpp
test/src/unit-element_access1.cpp
+13
-13
test/src/unit-element_access2.cpp
test/src/unit-element_access2.cpp
+26
-26
No files found.
test/src/unit-element_access1.cpp
View file @
ad053ef0
...
@@ -195,7 +195,7 @@ TEST_CASE("element access 1")
...
@@ -195,7 +195,7 @@ TEST_CASE("element access 1")
const
json
j_nonarray_const
(
j_nonarray
);
const
json
j_nonarray_const
(
j_nonarray
);
CHECK_NOTHROW
(
j_nonarray
[
0
]);
CHECK_NOTHROW
(
j_nonarray
[
0
]);
CHECK_THROWS_AS
(
j_nonarray_const
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray_const
[
0
],
json
::
type_error
&
);
CHECK_THROWS_WITH
(
j_nonarray_const
[
0
],
"[json.exception.type_error.305] cannot use operator[] with null"
);
CHECK_THROWS_WITH
(
j_nonarray_const
[
0
],
"[json.exception.type_error.305] cannot use operator[] with
a numeric argument with
null"
);
}
}
SECTION
(
"implicit transformation to properly filled array"
)
SECTION
(
"implicit transformation to properly filled array"
)
...
@@ -212,8 +212,8 @@ TEST_CASE("element access 1")
...
@@ -212,8 +212,8 @@ TEST_CASE("element access 1")
const
json
j_nonarray_const
(
j_nonarray
);
const
json
j_nonarray_const
(
j_nonarray
);
CHECK_THROWS_AS
(
j_nonarray
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray_const
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray_const
[
0
],
json
::
type_error
&
);
CHECK_THROWS_WITH
(
j_nonarray
[
0
],
"[json.exception.type_error.305] cannot use operator[] with boolean"
);
CHECK_THROWS_WITH
(
j_nonarray
[
0
],
"[json.exception.type_error.305] cannot use operator[] with
a numeric argument with
boolean"
);
CHECK_THROWS_WITH
(
j_nonarray_const
[
0
],
"[json.exception.type_error.305] cannot use operator[] with boolean"
);
CHECK_THROWS_WITH
(
j_nonarray_const
[
0
],
"[json.exception.type_error.305] cannot use operator[] with
a numeric argument with
boolean"
);
}
}
SECTION
(
"string"
)
SECTION
(
"string"
)
...
@@ -222,8 +222,8 @@ TEST_CASE("element access 1")
...
@@ -222,8 +222,8 @@ TEST_CASE("element access 1")
const
json
j_nonarray_const
(
j_nonarray
);
const
json
j_nonarray_const
(
j_nonarray
);
CHECK_THROWS_AS
(
j_nonarray
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray_const
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray_const
[
0
],
json
::
type_error
&
);
CHECK_THROWS_WITH
(
j_nonarray
[
0
],
"[json.exception.type_error.305] cannot use operator[] with string"
);
CHECK_THROWS_WITH
(
j_nonarray
[
0
],
"[json.exception.type_error.305] cannot use operator[] with
a numeric argument with
string"
);
CHECK_THROWS_WITH
(
j_nonarray_const
[
0
],
"[json.exception.type_error.305] cannot use operator[] with string"
);
CHECK_THROWS_WITH
(
j_nonarray_const
[
0
],
"[json.exception.type_error.305] cannot use operator[] with
a numeric argument with
string"
);
}
}
SECTION
(
"object"
)
SECTION
(
"object"
)
...
@@ -232,8 +232,8 @@ TEST_CASE("element access 1")
...
@@ -232,8 +232,8 @@ TEST_CASE("element access 1")
const
json
j_nonarray_const
(
j_nonarray
);
const
json
j_nonarray_const
(
j_nonarray
);
CHECK_THROWS_AS
(
j_nonarray
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray_const
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray_const
[
0
],
json
::
type_error
&
);
CHECK_THROWS_WITH
(
j_nonarray
[
0
],
"[json.exception.type_error.305] cannot use operator[] with object"
);
CHECK_THROWS_WITH
(
j_nonarray
[
0
],
"[json.exception.type_error.305] cannot use operator[] with
a numeric argument with
object"
);
CHECK_THROWS_WITH
(
j_nonarray_const
[
0
],
"[json.exception.type_error.305] cannot use operator[] with object"
);
CHECK_THROWS_WITH
(
j_nonarray_const
[
0
],
"[json.exception.type_error.305] cannot use operator[] with
a numeric argument with
object"
);
}
}
SECTION
(
"number (integer)"
)
SECTION
(
"number (integer)"
)
...
@@ -242,8 +242,8 @@ TEST_CASE("element access 1")
...
@@ -242,8 +242,8 @@ TEST_CASE("element access 1")
const
json
j_nonarray_const
(
j_nonarray
);
const
json
j_nonarray_const
(
j_nonarray
);
CHECK_THROWS_AS
(
j_nonarray
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray_const
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray_const
[
0
],
json
::
type_error
&
);
CHECK_THROWS_WITH
(
j_nonarray
[
0
],
"[json.exception.type_error.305] cannot use operator[] with number"
);
CHECK_THROWS_WITH
(
j_nonarray
[
0
],
"[json.exception.type_error.305] cannot use operator[] with
a numeric argument with
number"
);
CHECK_THROWS_WITH
(
j_nonarray_const
[
0
],
"[json.exception.type_error.305] cannot use operator[] with number"
);
CHECK_THROWS_WITH
(
j_nonarray_const
[
0
],
"[json.exception.type_error.305] cannot use operator[] with
a numeric argument with
number"
);
}
}
SECTION
(
"number (unsigned)"
)
SECTION
(
"number (unsigned)"
)
...
@@ -252,8 +252,8 @@ TEST_CASE("element access 1")
...
@@ -252,8 +252,8 @@ TEST_CASE("element access 1")
const
json
j_nonarray_const
(
j_nonarray
);
const
json
j_nonarray_const
(
j_nonarray
);
CHECK_THROWS_AS
(
j_nonarray
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray_const
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray_const
[
0
],
json
::
type_error
&
);
CHECK_THROWS_WITH
(
j_nonarray
[
0
],
"[json.exception.type_error.305] cannot use operator[] with number"
);
CHECK_THROWS_WITH
(
j_nonarray
[
0
],
"[json.exception.type_error.305] cannot use operator[] with
a numeric argument with
number"
);
CHECK_THROWS_WITH
(
j_nonarray_const
[
0
],
"[json.exception.type_error.305] cannot use operator[] with number"
);
CHECK_THROWS_WITH
(
j_nonarray_const
[
0
],
"[json.exception.type_error.305] cannot use operator[] with
a numeric argument with
number"
);
}
}
SECTION
(
"number (floating-point)"
)
SECTION
(
"number (floating-point)"
)
...
@@ -262,8 +262,8 @@ TEST_CASE("element access 1")
...
@@ -262,8 +262,8 @@ TEST_CASE("element access 1")
const
json
j_nonarray_const
(
j_nonarray
);
const
json
j_nonarray_const
(
j_nonarray
);
CHECK_THROWS_AS
(
j_nonarray
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray_const
[
0
],
json
::
type_error
&
);
CHECK_THROWS_AS
(
j_nonarray_const
[
0
],
json
::
type_error
&
);
CHECK_THROWS_WITH
(
j_nonarray
[
0
],
"[json.exception.type_error.305] cannot use operator[] with number"
);
CHECK_THROWS_WITH
(
j_nonarray
[
0
],
"[json.exception.type_error.305] cannot use operator[] with
a numeric argument with
number"
);
CHECK_THROWS_WITH
(
j_nonarray_const
[
0
],
"[json.exception.type_error.305] cannot use operator[] with number"
);
CHECK_THROWS_WITH
(
j_nonarray_const
[
0
],
"[json.exception.type_error.305] cannot use operator[] with
a numeric argument with
number"
);
}
}
}
}
}
}
...
...
test/src/unit-element_access2.cpp
View file @
ad053ef0
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment