github.com/kovansky/hugo@v0.92.3-0.20220224232819-63076e4ff19f/releaser/releasenotes_writer_test.go (about)

     1  // Copyright 2017-present The Hugo Authors. All rights reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  // http://www.apache.org/licenses/LICENSE-2.0
     7  //
     8  // Unless required by applicable law or agreed to in writing, software
     9  // distributed under the License is distributed on an "AS IS" BASIS,
    10  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    11  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  // Package commands defines and implements command-line commands and flags
    15  // used by Hugo. Commands and flags are implemented using Cobra.
    16  
    17  package releaser
    18  
    19  import (
    20  	"bytes"
    21  	"fmt"
    22  	"os"
    23  	"testing"
    24  
    25  	qt "github.com/frankban/quicktest"
    26  )
    27  
    28  func _TestReleaseNotesWriter(t *testing.T) {
    29  	skipIfNoToken(t)
    30  	if os.Getenv("CI") != "" {
    31  		// Travis has an ancient git with no --invert-grep: https://github.com/travis-ci/travis-ci/issues/6328
    32  		t.Skip("Skip git test on CI to make Travis happy..")
    33  	}
    34  
    35  	c := qt.New(t)
    36  
    37  	var b bytes.Buffer
    38  
    39  	// TODO(bep) consider to  query GitHub directly for the gitlog with author info, probably faster.
    40  	infos, err := getGitInfosBefore("HEAD", "v0.89.0", "hugo", "", false)
    41  	c.Assert(err, qt.IsNil)
    42  
    43  	c.Assert(writeReleaseNotes("0.89.0", infos, infos, &b), qt.IsNil)
    44  
    45  	fmt.Println(b.String())
    46  }