github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/examples/import-go/age-calculator_test.go (about)

     1  package main
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/bananabytelabs/wazero/internal/testing/maintester"
     7  	"github.com/bananabytelabs/wazero/internal/testing/require"
     8  )
     9  
    10  // Test_main ensures the following will work:
    11  //
    12  //	go run age-calculator.go 2000
    13  func Test_main(t *testing.T) {
    14  	// Set ENV to ensure this test doesn't need maintenance every year.
    15  	t.Setenv("CURRENT_YEAR", "2021")
    16  
    17  	stdout, _ := maintester.TestMain(t, main, "age-calculator", "2000")
    18  	require.Equal(t, `println >> 21
    19  log_i32 >> 21
    20  `, stdout)
    21  }