MCPcopy
hub / github.com/purpleidea/mgmt / TestComplexCmp0

Function TestComplexCmp0

lang/types/type_test.go:1314–1486  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1312}
1313
1314func TestComplexCmp0(t *testing.T) {
1315 type test struct { // an individual test
1316 name string
1317 typ1 *Type
1318 typ2 *Type
1319 err bool // expected err ?
1320 str string // expected output str
1321 }
1322 testCases := []test{}
1323
1324 {
1325 testCases = append(testCases, test{
1326 name: "int vs str",
1327 typ1: TypeInt,
1328 typ2: TypeStr,
1329 err: true,
1330 str: "",
1331 })
1332 }
1333 {
1334 testCases = append(testCases, test{
1335 name: "nested list vs list variant",
1336 typ1: NewType("[][]str"),
1337 typ2: &Type{
1338 Kind: KindList,
1339 Val: TypeVariant,
1340 },
1341 err: false,
1342 str: "variant",
1343 })
1344 }
1345 {
1346 testCases = append(testCases, test{
1347 name: "nil vs type",
1348 typ1: nil,
1349 typ2: NewType("[][]str"),
1350 err: false,
1351 str: "partial",
1352 })
1353 }
1354 {
1355 testCases = append(testCases, test{
1356 name: "variant vs type",
1357 typ1: TypeVariant,
1358 typ2: NewType("[][]str"),
1359 err: false,
1360 str: "variant",
1361 })
1362 }
1363 {
1364 testCases = append(testCases, test{
1365 name: "nil vs variant",
1366 typ1: nil,
1367 typ2: TypeVariant,
1368 err: false,
1369 str: "both",
1370 })
1371 }

Callers

nothing calls this directly

Calls 5

StrInListFunction · 0.92
NewTypeFunction · 0.85
LogfMethod · 0.80
ComplexCmpMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected