Skip to content
This repository was archived by the owner on Aug 22, 2020. It is now read-only.

Commit e326c47

Browse files
authored
Merge pull request #23 from infosiftr/go-version
Update Travis Go versions to 1.12 and 1.13
2 parents 5b48368 + 8e25067 commit e326c47

File tree

2 files changed

+19
-22
lines changed

2 files changed

+19
-22
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ language: go
33
go_import_path: github.com/docker-library/go-dockerlibrary
44

55
go:
6-
- 1.11.x
7-
- 1.10.x
6+
- 1.13.x
7+
- 1.12.x
88

99
os:
1010
- linux

pkg/templatelib/lib_test.go

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package templatelib_test
22

33
import (
4+
"strings"
45
"testing"
56
"text/template"
67
"unsafe"
@@ -11,35 +12,31 @@ import (
1112
func TestTernaryPanic(t *testing.T) {
1213
// one of the only places template.IsTrue will return "false" for the "ok" value is an UnsafePointer (hence this test)
1314

14-
defer func() {
15-
if r := recover(); r == nil {
16-
t.Errorf("Expected panic, executed successfully instead")
17-
} else if errText, ok := r.(string); !ok || errText != `template.IsTrue(<nil>) says things are NOT OK` {
18-
t.Errorf("Unexpected panic: %v", errText)
19-
}
20-
}()
21-
2215
tmpl, err := template.New("unsafe-pointer").Funcs(templatelib.FuncMap).Parse(`{{ ternary "true" "false" . }}`)
16+
if err != nil {
17+
t.Errorf("Unexpected error: %v", err)
18+
}
2319

2420
err = tmpl.Execute(nil, unsafe.Pointer(uintptr(0)))
25-
if err != nil {
26-
t.Errorf("Expected panic, got error instead: %v", err)
21+
if err == nil {
22+
t.Errorf("Expected error, executed successfully instead")
23+
}
24+
if !strings.HasSuffix(err.Error(), `template.IsTrue(<nil>) says things are NOT OK`) {
25+
t.Errorf("Expected specific error, got: %v", err)
2726
}
2827
}
2928

3029
func TestJoinPanic(t *testing.T) {
31-
defer func() {
32-
if r := recover(); r == nil {
33-
t.Errorf("Expected panic, executed successfully instead")
34-
} else if errText, ok := r.(string); !ok || errText != `"join" requires at least one argument` {
35-
t.Errorf("Unexpected panic: %v", r)
36-
}
37-
}()
38-
3930
tmpl, err := template.New("join-no-arg").Funcs(templatelib.FuncMap).Parse(`{{ join }}`)
31+
if err != nil {
32+
t.Errorf("Unexpected error: %v", err)
33+
}
4034

4135
err = tmpl.Execute(nil, nil)
42-
if err != nil {
43-
t.Errorf("Expected panic, got error instead: %v", err)
36+
if err == nil {
37+
t.Errorf("Expected error, executed successfully instead")
38+
}
39+
if !strings.HasSuffix(err.Error(), `"join" requires at least one argument`) {
40+
t.Errorf("Expected specific error, got: %v", err)
4441
}
4542
}

0 commit comments

Comments
 (0)