github.com/pix4d/terravalet@v0.8.1-0.20240131132849-abcd6a79eeeb/terravalet_script_test.go (about)

     1  // This file runs tests using the 'testscript' package.
     2  // To understand, see:
     3  // - https://github.com/rogpeppe/go-internal
     4  // - https://bitfieldconsulting.com/golang/test-scripts
     5  
     6  package main
     7  
     8  import (
     9  	"os"
    10  	"testing"
    11  
    12  	"github.com/rogpeppe/go-internal/testscript"
    13  )
    14  
    15  func TestMain(m *testing.M) {
    16  	// The commands map holds the set of command names, each with an associated
    17  	// run function which should return the code to pass to os.Exit.
    18  	// When [testscript.Run] is called, these commands are installed as regular
    19  	// commands in the shell path, so can be invoked with "exec".
    20  	os.Exit(testscript.RunMain(m, map[string]func() int{
    21  		"terravalet": Main,
    22  	}))
    23  }
    24  
    25  func TestScript(t *testing.T) {
    26  	testscript.Run(t, testscript.Params{
    27  		Dir: "testdata/script",
    28  	})
    29  }