Correct Value(kStringType) and more assertions

This commit is contained in:
Milo Yip
2015-01-13 23:49:53 +08:00
parent 29fa15580b
commit 24563b28fb
3 changed files with 25 additions and 2 deletions

View File

@@ -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;