wa-lang.org/wazero@v1.0.2/internal/gojs/argsenv_test.go (about)

     1  package gojs_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"wa-lang.org/wazero"
     7  	"wa-lang.org/wazero/internal/testing/require"
     8  )
     9  
    10  func Test_argsAndEnv(t *testing.T) {
    11  	t.Parallel()
    12  
    13  	stdout, stderr, err := compileAndRun(testCtx, "argsenv", wazero.NewModuleConfig().
    14  		WithEnv("c", "d").WithEnv("a", "b"))
    15  
    16  	require.EqualError(t, err, `module "" closed with exit_code(0)`)
    17  	require.Zero(t, stderr)
    18  	require.Equal(t, `
    19  args 0 = test
    20  args 1 = argsenv
    21  environ 0 = c=d
    22  environ 1 = a=b
    23  `, stdout)
    24  }