Add (still failing) test for partitioning an InternalTree
This commit is contained in:
28
test/support/internal_tree_test_helpers.ex
Normal file
28
test/support/internal_tree_test_helpers.ex
Normal file
@ -0,0 +1,28 @@
|
||||
defmodule Outlook.InternalTreeTestHelpers do
|
||||
|
||||
@default_uuid "11111111-1111-1111-1111-111111111111"
|
||||
|
||||
alias Outlook.InternalTree.{InternalNode,TranslationUnit}
|
||||
@doc "Set uuids to default value to make test results predictable."
|
||||
def unify_uuids_in_tunits([ %TranslationUnit{} = node | rest ]) do
|
||||
[
|
||||
%TranslationUnit{node |
|
||||
uuid: @default_uuid,
|
||||
content: String.replace(node.content, ~r/ uuid=""/, "")
|
||||
}
|
||||
| unify_uuids_in_tunits(rest) ]
|
||||
end
|
||||
|
||||
def unify_uuids_in_tunits([ %InternalNode{type: :element} = node | rest ]) do
|
||||
[ %InternalNode{node |
|
||||
content: unify_uuids_in_tunits(node.content)
|
||||
}
|
||||
| unify_uuids_in_tunits(rest) ]
|
||||
end
|
||||
|
||||
def unify_uuids_in_tunits([ %InternalNode{} = node | rest ]) do
|
||||
[ node | unify_uuids_in_tunits(rest) ]
|
||||
end
|
||||
|
||||
def unify_uuids_in_tunits([]), do: []
|
||||
end
|
||||
Reference in New Issue
Block a user