1// Copyright 2018 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// +build !nacl 6 7package main_test 8 9import ( 10 "bytes" 11 "io/ioutil" 12 "testing" 13 14 "cmd/go/internal/help" 15) 16 17func TestDocsUpToDate(t *testing.T) { 18 buf := new(bytes.Buffer) 19 // Match the command in mkalldocs.sh that generates alldocs.go. 20 help.Help(buf, []string{"documentation"}) 21 data, err := ioutil.ReadFile("alldocs.go") 22 if err != nil { 23 t.Fatalf("error reading alldocs.go: %v", err) 24 } 25 if !bytes.Equal(data, buf.Bytes()) { 26 t.Errorf("alldocs.go is not up to date; run mkalldocs.sh to regenerate it") 27 } 28} 29