github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/utils/validators_test.go (about) 1 /* 2 * Copyright (c) 2023-present unTill Pro, Ltd. 3 * @author Denis Gribanov 4 */ 5 6 package coreutils 7 8 import ( 9 "testing" 10 11 "github.com/stretchr/testify/require" 12 "github.com/voedger/voedger/pkg/appdef" 13 "github.com/voedger/voedger/pkg/istructs" 14 ) 15 16 func TestMatchQNames(t *testing.T) { 17 myQName := appdef.NewQName("sys", "myQName") 18 myQName2 := appdef.NewQName("sys", "myQName2") 19 myQName3 := appdef.NewQName("sys", "myQName3") 20 matcherFunc := MatchQName(myQName, myQName2) 21 tests := []struct { 22 qName appdef.QName 23 expected bool 24 }{ 25 { 26 qName: myQName, 27 expected: true, 28 }, 29 { 30 qName: myQName2, 31 expected: true, 32 }, 33 { 34 qName: myQName3, 35 expected: false, 36 }, 37 } 38 for _, ts := range tests { 39 cudRow := &TestObject{Name: ts.qName} 40 require.Equal(t, ts.expected, matcherFunc(cudRow, istructs.NullWSID, appdef.NullQName)) 41 } 42 }