MCPcopy Create free account
hub / github.com/devspace-sh/devspace / TestEqual

Function TestEqual

pkg/util/constraint/version_test.go:423–468  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

421}
422
423func TestEqual(t *testing.T) {
424 cases := []struct {
425 v1 string
426 v2 string
427 expected bool
428 }{
429 {"1.2.3", "1.4.5", false},
430 {"1.2-beta", "1.2-beta", true},
431 {"1.2", "1.1.4", false},
432 {"1.2", "1.2-beta", false},
433 {"1.2+foo", "1.2+beta", true},
434 {"v1.2", "v1.2-beta", false},
435 {"v1.2+foo", "v1.2+beta", true},
436 {"v1.2.3.4", "v1.2.3.4", true},
437 {"v1.2.0.0", "v1.2", true},
438 {"v1.2.0.0.1", "v1.2", false},
439 {"v1.2", "v1.2.0.0", true},
440 {"v1.2", "v1.2.0.0.1", false},
441 {"v1.2.0.0", "v1.2.0.0.1", false},
442 {"v1.2.3.0", "v1.2.3.4", false},
443 {"1.7rc2", "1.7rc1", false},
444 {"1.7rc2", "1.7", false},
445 {"1.2.0", "1.2.0-X-1.2.0+metadata~dist", false},
446 }
447
448 for _, tc := range cases {
449 v1, err := NewVersion(tc.v1)
450 if err != nil {
451 t.Fatalf("err: %s", err)
452 }
453
454 v2, err := NewVersion(tc.v2)
455 if err != nil {
456 t.Fatalf("err: %s", err)
457 }
458
459 actual := v1.Equal(v2)
460 expected := tc.expected
461 if actual != expected {
462 t.Fatalf(
463 "%s <=> %s\nexpected: %t\nactual: %t",
464 tc.v1, tc.v2,
465 expected, actual)
466 }
467 }
468}
469
470func TestGreaterThan(t *testing.T) {
471 cases := []struct {

Callers

nothing calls this directly

Calls 3

EqualMethod · 0.95
NewVersionFunction · 0.85
FatalfMethod · 0.45

Tested by

no test coverage detected