mirror of
https://github.com/Tencent/rapidjson.git
synced 2025-10-28 03:20:15 +01:00
Correct Value(kStringType) and more assertions
This commit is contained in:
@@ -600,7 +600,7 @@ TEST(Value, String) {
|
||||
// Constructor with type
|
||||
Value y(kStringType);
|
||||
EXPECT_TRUE(y.IsString());
|
||||
EXPECT_EQ(0, y.GetString());
|
||||
EXPECT_STREQ("", y.GetString()); // Empty string should be "" instead of 0 (issue 226)
|
||||
EXPECT_EQ(0u, y.GetStringLength());
|
||||
|
||||
// SetConsttring()
|
||||
@@ -677,6 +677,12 @@ TEST(Value, String) {
|
||||
#endif // RAPIDJSON_HAS_STDSTRING
|
||||
}
|
||||
|
||||
// Issue 226: Value of string type should not point to NULL
|
||||
TEST(Value, SetStringNullException) {
|
||||
Value v;
|
||||
EXPECT_THROW(v.SetString(0, 0), AssertException);
|
||||
}
|
||||
|
||||
TEST(Value, Array) {
|
||||
Value x(kArrayType);
|
||||
const Value& y = x;
|
||||
|
||||
Reference in New Issue
Block a user