Chromium Code Reviews| Index: base/values_unittest.cc |
| diff --git a/base/values_unittest.cc b/base/values_unittest.cc |
| index 9f34c62fd2a6e3c73f070f86107df5fa3bbd9674..4b1a68c683d12f5e869d501f14267e16fb3c6535 100644 |
| --- a/base/values_unittest.cc |
| +++ b/base/values_unittest.cc |
| @@ -508,6 +508,30 @@ TEST_F(ValuesTest, Equals) { |
| EXPECT_FALSE(dv.Equals(copy.get())); |
| } |
| +TEST_F(ValuesTest, StaticEquals) { |
| + Value* null_ptr = NULL; |
|
Mattias Nissler (ping if slow)
2010/12/01 10:36:36
Why have a var for this that even has more charact
battre (please use the other)
2010/12/01 17:44:38
Done.
|
| + scoped_ptr<Value> null1(Value::CreateNullValue()); |
| + scoped_ptr<Value> null2(Value::CreateNullValue()); |
| + EXPECT_TRUE(Value::Equals(null1.get(), null2.get())); |
| + EXPECT_TRUE(Value::Equals(null_ptr, null_ptr)); |
| + |
| + scoped_ptr<Value> i42(Value::CreateIntegerValue(42)); |
| + scoped_ptr<Value> j42(Value::CreateIntegerValue(42)); |
| + scoped_ptr<Value> i17(Value::CreateIntegerValue(17)); |
| + EXPECT_TRUE(Value::Equals(i42.get(), i42.get())); |
| + EXPECT_TRUE(Value::Equals(j42.get(), i42.get())); |
| + EXPECT_TRUE(Value::Equals(i42.get(), j42.get())); |
| + EXPECT_FALSE(Value::Equals(i42.get(), i17.get())); |
| + EXPECT_FALSE(Value::Equals(i42.get(), null_ptr)); |
| + EXPECT_FALSE(Value::Equals(null_ptr, i42.get())); |
| + |
| + // NULL and Value::CreateNullValue() are intentionally different: We need |
| + // support for NULL as a return value for "undefined" without caring for |
| + // ownership of the pointer. |
| + EXPECT_FALSE(Value::Equals(null1.get(), null_ptr)); |
| + EXPECT_FALSE(Value::Equals(null_ptr, null1.get())); |
| +} |
| + |
| TEST_F(ValuesTest, RemoveEmptyChildren) { |
| scoped_ptr<DictionaryValue> root(new DictionaryValue); |
| // Remove empty lists and dictionaries. |