@@ -6,12 +6,11 @@ import (
66)
77
88func TestBestVersion (t * testing.T ) {
9- store := New ("/dev/null" , false , nil )
9+ store := newEmpty ("/dev/null" , nil )
1010 for _ , v := range []string {"7.4.33" , "8.0.27" , "8.1.2" , "8.1.14" , "8.2.1" } {
11- store .addVersion (& Version {
12- Version : v ,
13- PHPPath : filepath .Join ("/foo" , v , "bin" , "php" ),
14- })
11+ ver := NewVersion (v )
12+ ver .PHPPath = filepath .Join ("/foo" , v , "bin" , "php" )
13+ store .addVersion (ver )
1514
1615 if ! store .IsVersionAvailable (v ) {
1716 t .Errorf ("Version %s should be shown as available" , v )
@@ -23,7 +22,7 @@ func TestBestVersion(t *testing.T) {
2322 if bestVersion == nil {
2423 t .Error ("8 requirement should find a best version" )
2524 } else if bestVersion .Version != "8.2.1" {
26- t .Error ("8 requirement should find 8.2.1 as best version" )
25+ t .Errorf ("8 requirement should find 8.2.1 as best version, got %s" , bestVersion . Version )
2726 }
2827 }
2928
@@ -32,7 +31,7 @@ func TestBestVersion(t *testing.T) {
3231 if bestVersion == nil {
3332 t .Error ("8.1 requirement should find a best version" )
3433 } else if bestVersion .Version != "8.1.14" {
35- t .Error ("8.1 requirement should find 8.1.14 as best version" )
34+ t .Errorf ("8.1 requirement should find 8.1.14 as best version, got %s" , bestVersion . Version )
3635 }
3736 }
3837
@@ -41,7 +40,7 @@ func TestBestVersion(t *testing.T) {
4140 if bestVersion == nil {
4241 t .Error ("8.0.10 requirement should find a best version" )
4342 } else if bestVersion .Version != "8.0.27" {
44- t .Error ("8.0.10 requirement should find 8.0.27 as best version" )
43+ t .Errorf ("8.0.10 requirement should find 8.0.27 as best version, got %s" , bestVersion . Version )
4544 } else if warning == "" {
4645 t .Error ("8.0.10 requirement should trigger a warning" )
4746 }
@@ -52,7 +51,7 @@ func TestBestVersion(t *testing.T) {
5251 if bestVersion == nil {
5352 t .Error ("8.0.99 requirement should find a best version" )
5453 } else if bestVersion .Version != "8.0.27" {
55- t .Error ("8.0.99 requirement should find 8.0.27 as best version" )
54+ t .Errorf ("8.0.99 requirement should find 8.0.27 as best version, got %s" , bestVersion . Version )
5655 } else if warning != "" {
5756 t .Error ("8.0.99 requirement should not trigger a warning" )
5857 }
0 commit comments