From 9e37edd2c690aeefc214283f92fd30d71f3c8867 Mon Sep 17 00:00:00 2001 From: Jesse Costello-Good Date: Fri, 20 Oct 2023 09:34:42 -0700 Subject: [PATCH] Fix DFS test. PiperOrigin-RevId: 575241826 --- .../template/soy/internal/util/TreeStreamsTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/java/tests/com/google/template/soy/internal/util/TreeStreamsTest.java b/java/tests/com/google/template/soy/internal/util/TreeStreamsTest.java index b356b91ce0..bec0696fa7 100644 --- a/java/tests/com/google/template/soy/internal/util/TreeStreamsTest.java +++ b/java/tests/com/google/template/soy/internal/util/TreeStreamsTest.java @@ -39,7 +39,8 @@ public void testBreadthFirst() { .put(2, list(4, 5)) .put(3, list(6, 7)) .buildOrThrow())) - .containsExactly(1, 2, 3, 4, 5, 6, 7); + .containsExactly(1, 2, 3, 4, 5, 6, 7) + .inOrder(); } @Test @@ -52,7 +53,8 @@ public void testDepthFirst() { .put(2, list(4, 5)) .put(3, list(6, 7)) .buildOrThrow())) - .containsExactly(1, 2, 4, 5, 3, 6, 7); + .containsExactly(1, 2, 4, 5, 3, 6, 7) + .inOrder(); } private static ImmutableList list(T... items) { @@ -65,7 +67,7 @@ private static ImmutableList bfs(T root, Map> data) { } private static ImmutableList dfs(T root, Map> data) { - return TreeStreams.breadthFirst(root, k -> data.getOrDefault(k, ImmutableList.of())) + return TreeStreams.depthFirst(root, k -> data.getOrDefault(k, ImmutableList.of())) .collect(ImmutableList.toImmutableList()); } }