Lines Matching full:parent
33 unique_node_ptr CreateNode(node* parent, const std::string& path, const int transforms = 0) { in CreateNode() argument
35 node::Create(parent, path, "", true, transforms, 0, &lock_, 0, &tracker_), in CreateNode()
57 unique_node_ptr parent = CreateNode(nullptr, "/path"); in TEST_F() local
58 ASSERT_EQ(1, GetRefCount(parent.get())); in TEST_F()
60 // Adding a child to a parent node increments its refcount. in TEST_F()
61 unique_node_ptr child = CreateNode(parent.get(), "subdir"); in TEST_F()
62 ASSERT_EQ(2, GetRefCount(parent.get())); in TEST_F()
65 ASSERT_EQ(child.get(), parent->LookupChildByName("subdir", false /* acquire */)); in TEST_F()
87 unique_node_ptr parent = CreateNode(nullptr, "/path"); in TEST_F() local
89 unique_node_ptr child = CreateNode(parent.get(), "subdir"); in TEST_F()
90 ASSERT_EQ(2, GetRefCount(parent.get())); in TEST_F()
91 ASSERT_EQ(child.get(), parent->LookupChildByName("subdir", false /* acquire */)); in TEST_F()
93 child->Rename("subdir_new", parent.get()); in TEST_F()
95 ASSERT_EQ(2, GetRefCount(parent.get())); in TEST_F()
96 ASSERT_EQ(nullptr, parent->LookupChildByName("subdir", false /* acquire */)); in TEST_F()
97 ASSERT_EQ(child.get(), parent->LookupChildByName("subdir_new", false /* acquire */)); in TEST_F()
143 unique_node_ptr parent = CreateNode(nullptr, "/path"); in TEST_F() local
145 unique_node_ptr child0 = CreateNode(parent.get(), "subdir", 0 /* transforms */); in TEST_F()
146 unique_node_ptr child1 = CreateNode(parent.get(), "subdir", 1 /* transforms */); in TEST_F()
147 ASSERT_EQ(3, GetRefCount(parent.get())); in TEST_F()
149 parent->LookupChildByName("subdir", false /* acquire */, 0 /* transforms */)); in TEST_F()
151 parent->LookupChildByName("subdir", false /* acquire */, 1 /* transforms */)); in TEST_F()
153 parent->RenameChild("subdir", "subdir_new", parent.get()); in TEST_F()
155 ASSERT_EQ(3, GetRefCount(parent.get())); in TEST_F()
157 parent->LookupChildByName("subdir", false /* acquire */, 0 /* transforms */)); in TEST_F()
159 parent->LookupChildByName("subdir", false /* acquire */, 1 /* transforms */)); in TEST_F()
161 parent->LookupChildByName("subdir_new", false /* acquire */, 0 /* transforms */)); in TEST_F()
163 parent->LookupChildByName("subdir_new", false /* acquire */, 1 /* transforms */)); in TEST_F()
238 unique_node_ptr parent = CreateNode(nullptr, "/path"); in TEST_F() local
239 ASSERT_EQ("/path", parent->BuildPath()); in TEST_F()
241 unique_node_ptr child = CreateNode(parent.get(), "subdir"); in TEST_F()
244 unique_node_ptr child2 = CreateNode(parent.get(), "subdir2"); in TEST_F()
252 unique_node_ptr parent = CreateNode(nullptr, "/path"); in TEST_F() local
253 unique_node_ptr child = CreateNode(parent.get(), "subdir"); in TEST_F()
255 ASSERT_EQ(child.get(), parent->LookupChildByName("subdir", false /* acquire */)); in TEST_F()
257 ASSERT_EQ(nullptr, parent->LookupChildByName("subdir", false /* acquire */)); in TEST_F()
261 unique_node_ptr parent = CreateNode(nullptr, "/path"); in TEST_F() local
262 unique_node_ptr child0 = CreateNode(parent.get(), "subdir", 0 /* transforms */); in TEST_F()
263 unique_node_ptr child1 = CreateNode(parent.get(), "subdir", 1 /* transforms */); in TEST_F()
266 parent->LookupChildByName("subdir", false /* acquire */, 0 /* transforms */)); in TEST_F()
268 parent->LookupChildByName("subdir", false /* acquire */, 1 /* transforms */)); in TEST_F()
269 parent->SetDeletedForChild("subdir"); in TEST_F()
271 parent->LookupChildByName("subdir", false /* acquire */, 0 /* transforms */)); in TEST_F()
273 parent->LookupChildByName("subdir", false /* acquire */, 1 /* transforms */)); in TEST_F()
277 unique_node_ptr parent = CreateNode(nullptr, "/path"); in TEST_F() local
280 node* child = node::Create(parent.get(), "subdir", "", true, 0, 0, &lock_, 0, &tracker_); in TEST_F()
285 ASSERT_EQ(child, parent->LookupChildByName("subdir", false /* acquire */)); in TEST_F()
287 ASSERT_EQ(nullptr, parent->LookupChildByName("subdir", false /* acquire */)); in TEST_F()
291 unique_node_ptr parent = CreateNode(nullptr, "/path"); in TEST_F() local
292 unique_node_ptr child = CreateNode(parent.get(), "subdir"); in TEST_F()
294 ASSERT_EQ(child.get(), parent->LookupChildByName("subdir", false /* acquire */)); in TEST_F()
295 ASSERT_EQ(nullptr, parent->LookupChildByName("", false /* acquire */)); in TEST_F()
299 unique_node_ptr parent = CreateNode(nullptr, "/path"); in TEST_F() local
300 unique_node_ptr child0 = CreateNode(parent.get(), "subdir", 0 /* transforms */); in TEST_F()
301 unique_node_ptr child1 = CreateNode(parent.get(), "subdir", 1 /* transforms */); in TEST_F()
303 ASSERT_EQ(child0.get(), parent->LookupChildByName("subdir", false /* acquire */)); in TEST_F()
305 parent->LookupChildByName("subdir", false /* acquire */, 0 /* transforms */)); in TEST_F()
307 parent->LookupChildByName("subdir", false /* acquire */, 1 /* transforms */)); in TEST_F()
309 parent->LookupChildByName("subdir", false /* acquire */, 2 /* transforms */)); in TEST_F()
313 unique_node_ptr parent = CreateNode(nullptr, "/path"); in TEST_F() local
314 unique_node_ptr child = CreateNode(parent.get(), "subdir"); in TEST_F()
316 ASSERT_EQ(child.get(), parent->LookupChildByName("subdir", false /* acquire */)); in TEST_F()
319 ASSERT_EQ(child.get(), parent->LookupChildByName("subdir", true /* acquire */)); in TEST_F()
324 unique_node_ptr parent = CreateNode(nullptr, "/path"); in TEST_F() local
325 unique_node_ptr child = CreateNode(parent.get(), "subdir"); in TEST_F()
326 unique_node_ptr child2 = CreateNode(parent.get(), "subdir2"); in TEST_F()
329 ASSERT_EQ(parent.get(), node::LookupAbsolutePath(parent.get(), "/path")); in TEST_F()
330 ASSERT_EQ(parent.get(), node::LookupAbsolutePath(parent.get(), "/path/")); in TEST_F()
331 ASSERT_EQ(nullptr, node::LookupAbsolutePath(parent.get(), "/path2")); in TEST_F()
333 ASSERT_EQ(child.get(), node::LookupAbsolutePath(parent.get(), "/path/subdir")); in TEST_F()
334 ASSERT_EQ(child.get(), node::LookupAbsolutePath(parent.get(), "/path/subdir/")); in TEST_F()
336 ASSERT_EQ(child.get(), node::LookupAbsolutePath(parent.get(), "/path//subdir")); in TEST_F()
337 ASSERT_EQ(child.get(), node::LookupAbsolutePath(parent.get(), "/path///subdir")); in TEST_F()
339 ASSERT_EQ(child2.get(), node::LookupAbsolutePath(parent.get(), "/path/subdir2")); in TEST_F()
340 ASSERT_EQ(child2.get(), node::LookupAbsolutePath(parent.get(), "/path/subdir2/")); in TEST_F()
342 ASSERT_EQ(nullptr, node::LookupAbsolutePath(parent.get(), "/path/subdir3/")); in TEST_F()
344 ASSERT_EQ(subchild.get(), node::LookupAbsolutePath(parent.get(), "/path/subdir2/subsubdir")); in TEST_F()
345 ASSERT_EQ(nullptr, node::LookupAbsolutePath(parent.get(), "/path/subdir/subsubdir")); in TEST_F()
444 unique_node_ptr parent = CreateNode(nullptr, "/path"); in TEST_F() local
445 unique_node_ptr mixed_child = CreateNode(parent.get(), "cHiLd"); in TEST_F()
447 node* upper_child = parent->LookupChildByName("CHILD", false /* acquire */); in TEST_F()
448 node* lower_child = parent->LookupChildByName("child", false /* acquire */); in TEST_F()
455 unique_node_ptr parent = CreateNode(nullptr, "/path1"); in TEST_F() local
456 unique_node_ptr child = CreateNode(parent.get(), "subdir"); in TEST_F()
458 ASSERT_EQ(child.get(), parent->LookupChildByName("SuBdIr", false /* acquire */)); in TEST_F()
459 ASSERT_EQ(2, GetRefCount(parent.get())); in TEST_F()
461 child->Rename("subdir", parent.get()); in TEST_F()
463 ASSERT_EQ(child.get(), parent->LookupChildByName("SuBdIr", false /* acquire */)); in TEST_F()
464 ASSERT_EQ(2, GetRefCount(parent.get())); in TEST_F()
504 unique_node_ptr parent = CreateNode(nullptr, "/path"); in TEST_F() local
505 unique_node_ptr foo1 = CreateNode(parent.get(), "FoO"); in TEST_F()
506 unique_node_ptr foo2 = CreateNode(parent.get(), "fOo"); in TEST_F()
507 unique_node_ptr bar1 = CreateNode(parent.get(), "BAR"); in TEST_F()
508 unique_node_ptr bar2 = CreateNode(parent.get(), "bar"); in TEST_F()
509 unique_node_ptr baz1 = CreateNode(parent.get(), "baZ"); in TEST_F()
510 unique_node_ptr baz2 = CreateNode(parent.get(), "Baz"); in TEST_F()
513 auto node1 = parent->LookupChildByName(name, false /* acquire */); in TEST_F()
517 auto node2 = parent->LookupChildByName(name, false /* acquire */); in TEST_F()
521 ASSERT_EQ(nullptr, parent->LookupChildByName(name, false /* acquire */)); in TEST_F()
546 unique_node_ptr parent = CreateNode(nullptr, "/path"); in TEST_F() local
547 unique_node_ptr foo1 = CreateNode(parent.get(), "FoO"); in TEST_F()
548 unique_node_ptr foo2 = CreateNode(parent.get(), "fOo"); in TEST_F()
549 unique_node_ptr foo3 = CreateNode(parent.get(), "foo"); in TEST_F()
570 node* node_all = ForChild(parent.get(), "foo", test_fn_match_all); in TEST_F()
576 node* node_first = ForChild(parent.get(), "foo", test_fn_match_first); in TEST_F()
581 node* node_none = ForChild(parent.get(), "bar", test_fn_match_none); in TEST_F()