MCPcopy Create free account
hub / github.com/Masterminds/semver / TestParts

Function TestParts

version_test.go:422–443  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

420}
421
422func TestParts(t *testing.T) {
423 v, err := NewVersion("1.2.3-beta.1+build.123")
424 if err != nil {
425 t.Error("Error parsing version 1.2.3-beta.1+build.123")
426 }
427
428 if v.Major() != 1 {
429 t.Error("Major() returning wrong value")
430 }
431 if v.Minor() != 2 {
432 t.Error("Minor() returning wrong value")
433 }
434 if v.Patch() != 3 {
435 t.Error("Patch() returning wrong value")
436 }
437 if v.Prerelease() != "beta.1" {
438 t.Error("Prerelease() returning wrong value")
439 }
440 if v.Metadata() != "build.123" {
441 t.Error("Metadata() returning wrong value")
442 }
443}
444
445func TestCoerceString(t *testing.T) {
446 tests := []struct {

Callers

nothing calls this directly

Calls 6

MajorMethod · 0.95
MinorMethod · 0.95
PatchMethod · 0.95
PrereleaseMethod · 0.95
MetadataMethod · 0.95
NewVersionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…