github.com/olliephillips/hugo@v0.42.2/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  	"github.com/stretchr/testify/require"
    26  )
    27  
    28  func _TestReleaseNotesWriter(t *testing.T) {
    29  	if os.Getenv("CI") != "" {
    30  		// Travis has an ancient git with no --invert-grep: https://github.com/travis-ci/travis-ci/issues/6328
    31  		t.Skip("Skip git test on CI to make Travis happy.")
    32  	}
    33  
    34  	var b bytes.Buffer
    35  
    36  	// TODO(bep) consider to query GitHub directly for the gitlog with author info, probably faster.
    37  	infos, err := getGitInfosBefore("HEAD", "v0.20", "hugo", "", false)
    38  	require.NoError(t, err)
    39  
    40  	require.NoError(t, writeReleaseNotes("0.21", infos, infos, &b))
    41  
    42  	fmt.Println(b.String())
    43  
    44  }