diff options
Diffstat (limited to 'mojo/public/cpp/bindings/tests/map_unittest.cc')
-rw-r--r-- | mojo/public/cpp/bindings/tests/map_unittest.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mojo/public/cpp/bindings/tests/map_unittest.cc b/mojo/public/cpp/bindings/tests/map_unittest.cc index 4ccd8c0..e4d2bee 100644 --- a/mojo/public/cpp/bindings/tests/map_unittest.cc +++ b/mojo/public/cpp/bindings/tests/map_unittest.cc @@ -42,6 +42,23 @@ const size_t kStringIntDataSize = 4; using MapTest = testing::Test; +// Tests null and empty maps. +TEST_F(MapTest, NullAndEmpty) { + Map<char, char> map0; + EXPECT_TRUE(map0.empty()); + EXPECT_FALSE(map0.is_null()); + map0 = nullptr; + EXPECT_TRUE(map0.is_null()); + EXPECT_FALSE(map0.empty()); + + Map<char, char> map1(nullptr); + EXPECT_TRUE(map1.is_null()); + EXPECT_FALSE(map1.empty()); + map1.SetToEmpty(); + EXPECT_TRUE(map1.empty()); + EXPECT_FALSE(map1.is_null()); +} + // Tests that basic Map operations work. TEST_F(MapTest, InsertWorks) { Map<String, int> map; |