aboutsummaryrefslogtreecommitdiff
path: root/content/content_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'content/content_test.go')
-rw-r--r--content/content_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/content/content_test.go b/content/content_test.go
index 4c0ff2a..f48d003 100644
--- a/content/content_test.go
+++ b/content/content_test.go
@@ -18,8 +18,8 @@ import (
// Test that all the .go files inside the content file build
// and execute (without checking for output correctness).
-// Files that contain the string "// +build no-build" are not built.
-// Files that contain the string "// +build no-run" are not executed.
+// Files that contain the string "//go:build nobuild" are not built.
+// Files that contain the string "//go:build norun" are not executed.
func TestContent(t *testing.T) {
if _, err := exec.LookPath("go"); err != nil {
t.Skipf("skipping because 'go' executable not available: %v", err)
@@ -55,14 +55,14 @@ func testSnippet(t *testing.T, path, scratch string) error {
}
build := string(bytes.SplitN(b, []byte{'\n'}, 2)[0])
- if !strings.HasPrefix(build, "// +build ") {
- return errors.New("first line is not a +build comment")
+ if !strings.HasPrefix(build, "//go:build ") {
+ return errors.New("first line is not a go:build comment")
}
if !strings.Contains(build, "OMIT") {
return errors.New(`+build comment does not contain "OMIT"`)
}
- if strings.Contains(build, "no-build") {
+ if strings.Contains(build, "nobuild") {
return nil
}
bin := filepath.Join(scratch, filepath.Base(path)+".exe")
@@ -72,7 +72,7 @@ func testSnippet(t *testing.T, path, scratch string) error {
}
defer os.Remove(bin)
- if strings.Contains(build, "no-run") {
+ if strings.Contains(build, "norun") {
return nil
}
out, err = exec.Command(bin).CombinedOutput()