github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/internal/gojs/argsenv_test.go (about)

     1  package gojs_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/bananabytelabs/wazero"
     7  	"github.com/bananabytelabs/wazero/internal/gojs/config"
     8  	"github.com/bananabytelabs/wazero/internal/testing/require"
     9  )
    10  
    11  func Test_argsAndEnv(t *testing.T) {
    12  	t.Parallel()
    13  
    14  	stdout, stderr, err := compileAndRun(testCtx, "argsenv", func(moduleConfig wazero.ModuleConfig) (wazero.ModuleConfig, *config.Config) {
    15  		return moduleConfig.WithEnv("c", "d").WithEnv("a", "b"), config.NewConfig()
    16  	})
    17  
    18  	require.Zero(t, stderr)
    19  	require.NoError(t, err)
    20  	require.Equal(t, `
    21  args 0 = test
    22  args 1 = argsenv
    23  environ 0 = c=d
    24  environ 1 = a=b
    25  `, stdout)
    26  }