mirror of
https://lab.forgefriends.org/friendlyforgeformat/gof3.git
synced 2025-10-06 08:02:46 +02:00
36 lines
961 B
Go
36 lines
961 B
Go
// Copyright Earl Warren <contact@earl-warren.org>
|
|
// Copyright Loïc Dachary <loic@dachary.org>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package generic
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestUnifyNilRootOrigin(t *testing.T) {
|
|
ctx := context.Background()
|
|
|
|
origin := NewTestTree()
|
|
destination := NewTestTree()
|
|
destinationRoot := NewNode()
|
|
destination.SetRoot(destinationRoot)
|
|
assert.Equal(t, destinationRoot, destination.GetRoot())
|
|
TreeUnify(ctx, origin, destination, NewUnifyOptions(destination))
|
|
assert.EqualValues(t, nil, destination.GetRoot())
|
|
}
|
|
|
|
func TestUnifyNilRootDestination(t *testing.T) {
|
|
ctx := context.Background()
|
|
|
|
origin := NewTestTree()
|
|
originRoot := origin.Factory(ctx, KindTestNodeLevelOne)
|
|
origin.SetRoot(originRoot)
|
|
destination := NewTestTree()
|
|
TreeUnify(ctx, origin, destination, NewUnifyOptions(destination))
|
|
assert.EqualValues(t, KindTestNodeLevelOne, destination.GetRoot().GetKind())
|
|
}
|