| // Copyright 2011 Google Inc. All Rights Reserved. |
| #include "intern_table.h" |
| class InternTableTest : public RuntimeTest {}; |
| TEST_F(InternTableTest, Intern) { |
| InternTable intern_table; |
| String* foo_1 = intern_table.Intern(3, "foo"); |
| String* foo_2 = intern_table.Intern(3, "foo"); |
| String* foo_3 = String::AllocFromAscii("foo"); |
| String* bar = intern_table.Intern(3, "bar"); |
| EXPECT_TRUE(foo_1->Equals("foo")); |
| EXPECT_TRUE(foo_2->Equals("foo")); |
| EXPECT_TRUE(foo_3->Equals("foo")); |
| EXPECT_TRUE(foo_1 != NULL); |
| EXPECT_TRUE(foo_2 != NULL); |