github.com/pvitto98/fabric@v2.1.1+incompatible/common/metrics/gendoc/gendoc_suite_test.go (about)

     1  /*
     2  Copyright IBM Corp. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package gendoc_test
     8  
     9  import (
    10  	"go/ast"
    11  	"go/parser"
    12  	"go/token"
    13  	"testing"
    14  
    15  	. "github.com/onsi/ginkgo"
    16  	. "github.com/onsi/gomega"
    17  )
    18  
    19  func TestGendoc(t *testing.T) {
    20  	RegisterFailHandler(Fail)
    21  	RunSpecs(t, "Gendoc Suite")
    22  }
    23  
    24  func ParseFile(filename string) (*ast.File, error) {
    25  	fs := token.NewFileSet()
    26  	f, err := parser.ParseFile(fs, filename, nil, parser.ParseComments)
    27  	if err != nil {
    28  		return nil, err
    29  	}
    30  
    31  	return f, nil
    32  }