nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: kumahq/kuma
Pull request #1330 (2020-12-17 16:57:46)

fix(kuma-dp) HttpGet readiness (and liveness) probe path gets a "/" prepended if not supplied (bp #1326)
This is an automated backport of pull request #1326 done by Mergify
---


<details>
<summary>Mergify commands and options</summary>

<br />

More conditions and actions can be found in the [documentation](https://docs.mergify.io/).

You can also trigger Mergify actions by commenting on this pull request:

- `@Mergifyio refresh` will re-evaluate the rules
- `@Mergifyio rebase` will rebase this PR on its base branch
- `@Mergifyio update` will merge the base branch into this PR
- `@Mergifyio backport <destination>` will backport this PR on `<destination>` branch

Additionally, on Mergify [dashboard](https://dashboard.mergify.io/) you can:

- look at your merge queues
- generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.io/
</details>



Patch:
diff --git a/pkg/plugins/runtime/k8s/probes/probe.go b/pkg/plugins/runtime/k8s/probes/probe.go
index 828de9b79..a02c28b68 100644
--- a/pkg/plugins/runtime/k8s/probes/probe.go
+++ b/pkg/plugins/runtime/k8s/probes/probe.go
@@ -51,11 +51,15 @@ func (p KumaProbe) ToVirtual(virtualPort uint32) (KumaProbe, error) {
 		return KumaProbe{}, errors.Errorf("cannot override Pod's probes. Port for probe cannot "+
 			"be set to %d. It is reserved for the dataplane that will serve pods without mTLS.", virtualPort)
 	}
+	probePath := p.Path()
+	if !strings.HasPrefix(p.Path(), "/") {
+		probePath = fmt.Sprintf("/%s", p.Path())
+	}
 	return KumaProbe{
 		Handler: kube_core.Handler{
 			HTTPGet: &kube_core.HTTPGetAction{
 				Port: intstr.FromInt(int(virtualPort)),
-				Path: fmt.Sprintf("/%d%s", p.Port(), p.Path()),
+				Path: fmt.Sprintf("/%d%s", p.Port(), probePath),
 			},
 		},
 	}, nil


Test patch:
diff --git a/pkg/plugins/runtime/k8s/probes/probe_test.go b/pkg/plugins/runtime/k8s/probes/probe_test.go
index 76f52c863..aac214f92 100644
--- a/pkg/plugins/runtime/k8s/probes/probe_test.go
+++ b/pkg/plugins/runtime/k8s/probes/probe_test.go
@@ -62,4 +62,22 @@ var _ = Describe("KumaProbe", func() {
 				"to 9000. It is reserved for the dataplane that will serve pods without mTLS."))
 		})
 	})
+
+	Context("Prepend /", func() {
+		It("should convert to path with prepended /", func() {
+			podProbeYaml := `
+                httpGet:
+                  path: c1/hc
+                  port: 8080
+`
+			probe := kube_core.Probe{}
+			err := yaml.Unmarshal([]byte(podProbeYaml), &probe)
+			Expect(err).ToNot(HaveOccurred())
+
+			virtual, err := probes.KumaProbe(probe).ToVirtual(9000)
+			Expect(err).ToNot(HaveOccurred())
+			Expect(virtual.Path()).To(Equal("/8080/c1/hc"))
+			Expect(virtual.Port()).To(Equal(uint32(9000)))
+		})
+	})
 })
Repository: docker/compose
Pull request #11752 (2024-04-22 08:43:54)

fix support for `--flag=value` syntax in compatibility mode
**What I did**
fix support for `--flag=value` syntax in compatibility mode

**Related issue**
fixes https://github.com/docker/compose/issues/11749

**(not mandatory) A picture of a cute animal, if possible in relation to what you did**
![image](https://github.com/docker/compose/assets/132757/02b54ae5-c53a-4ce0-958c-f523c2d33da1)



Patch:
diff --git a/cmd/compatibility/convert.go b/cmd/compatibility/convert.go
index 831a6ecb9..5437840cf 100644
--- a/cmd/compatibility/convert.go
+++ b/cmd/compatibility/convert.go
@@ -19,6 +19,7 @@ package compatibility
 import (
 	"fmt"
 	"os"
+	"strings"
 
 	"github.com/docker/compose/v2/cmd/compose"
 )
@@ -55,6 +56,7 @@ func Convert(args []string) []string {
 	var rootFlags []string
 	command := []string{compose.PluginName}
 	l := len(args)
+ARGS:
 	for i := 0; i < l; i++ {
 		arg := args[i]
 		if contains(getCompletionCommands(), arg) {
@@ -81,14 +83,23 @@ func Convert(args []string) []string {
 			rootFlags = append(rootFlags, arg)
 			continue
 		}
-		if contains(getStringFlags(), arg) {
-			i++
-			if i >= l {
-				fmt.Fprintf(os.Stderr, "flag needs an argument: '%s'\n", arg)
-				os.Exit(1)
+		for _, flag := range getStringFlags() {
+			if arg == flag {
+				i++
+				if i >= l {
+					fmt.Fprintf(os.Stderr, "flag needs an argument: '%s'\n", arg)
+					os.Exit(1)
+				}
+				rootFlags = append(rootFlags, arg, args[i])
+				continue ARGS
+			}
+			if strings.HasPrefix(arg, flag) {
+				_, val, found := strings.Cut(arg, "=")
+				if found {
+					rootFlags = append(rootFlags, flag, val)
+					continue ARGS
+				}
 			}
-			rootFlags = append(rootFlags, arg, args[i])
-			continue
 		}
 		command = append(command, arg)
 	}


Test patch:
diff --git a/cmd/compatibility/convert_test.go b/cmd/compatibility/convert_test.go
index b0bb71f57..b0dae821b 100644
--- a/cmd/compatibility/convert_test.go
+++ b/cmd/compatibility/convert_test.go
@@ -38,6 +38,11 @@ func Test_convert(t *testing.T) {
 			args: []string{"--context", "foo", "-f", "compose.yaml", "up"},
 			want: []string{"--context", "foo", "compose", "-f", "compose.yaml", "up"},
 		},
+		{
+			name: "with context arg",
+			args: []string{"--context=foo", "-f", "compose.yaml", "up"},
+			want: []string{"--context", "foo", "compose", "-f", "compose.yaml", "up"},
+		},
 		{
 			name: "with host",
 			args: []string{"--host", "tcp://1.2.3.4", "up"},
Repository: tetratelabs/wazero
Pull request #1017 (2023-01-10 00:43:39)

fs: fixes timebomb on or'd flags with O_RDONLY
@achille-roussel mentioned on chat that we have an accident waiting to happen. This fixes it and backfills the missing test.



Patch:
diff --git a/internal/syscallfs/readfs.go b/internal/syscallfs/readfs.go
index 8533e7ab..99d35e53 100644
--- a/internal/syscallfs/readfs.go
+++ b/internal/syscallfs/readfs.go
@@ -33,8 +33,29 @@ func (r *readFS) Path() string {
 
 // OpenFile implements FS.OpenFile
 func (r *readFS) OpenFile(path string, flag int, perm fs.FileMode) (fs.File, error) {
-	if flag != 0 && flag != os.O_RDONLY {
+	// TODO: Once the real implementation is complete, move the below to
+	// /RATIONALE.md. Doing this while the type is unstable creates
+	// documentation drift as we expect a lot of reshaping meanwhile.
+	//
+	// Callers of this function expect to either open a valid file handle, or
+	// get an error, if they can't. We want to return ENOSYS if opened for
+	// anything except reads.
+	//
+	// Instead, we could return a fake no-op file on O_WRONLY. However, this
+	// hurts observability because a later write error to that file will be on
+	// a different source code line than the root cause which is opening with
+	// an unsupported flag.
+	//
+	// The tricky part is os.RD_ONLY is typically defined as zero, so while the
+	// parameter is named flag, the part about opening read vs write isn't a
+	// typical bitflag. We can't compare against zero anyway, because even if
+	// there isn't a current flag to OR in with that, there may be in the
+	// future. What we do instead is mask the flags about read/write mode and
+	// check if they are the opposite of read or not.
+	switch flag & (os.O_RDONLY | os.O_WRONLY | os.O_RDWR) {
+	case os.O_WRONLY, os.O_RDWR:
 		return nil, syscall.ENOSYS
+	default: // os.O_RDONLY so we are ok!
 	}
 
 	f, err := r.fs.OpenFile(path, flag, perm)


Test patch:
diff --git a/internal/syscallfs/syscallfs_test.go b/internal/syscallfs/syscallfs_test.go
index d8a78054..3bc2e259 100644
--- a/internal/syscallfs/syscallfs_test.go
+++ b/internal/syscallfs/syscallfs_test.go
@@ -116,6 +116,17 @@ func testOpen_Read(t *testing.T, tmpDir string, testFS FS) {
 			}
 		}
 	})
+
+	// Make sure O_RDONLY isn't treated bitwise as it is usually zero.
+	t.Run("or'd flag", func(t *testing.T) {
+		// Example of a flag that can be or'd into O_RDONLY even if not
+		// currently supported in WASI or GOOS=js
+		const O_NOATIME = 0x40000
+
+		f, err := testFS.OpenFile(file, os.O_RDONLY|O_NOATIME, 0)
+		require.NoError(t, err)
+		defer f.Close()
+	})
 }
 
 func testUtimes(t *testing.T, tmpDir string, testFS FS) {
Repository: tetratelabs/wazero
Pull request #1116 (2023-02-10 05:57:10)

cli: renames interp flag to interpreter
non-shortcut flags should be complete words or abbreviations, not truncated words.



Patch:
diff --git a/cmd/wazero/wazero.go b/cmd/wazero/wazero.go
index 67a3fbec..fbbc54c1 100644
--- a/cmd/wazero/wazero.go
+++ b/cmd/wazero/wazero.go
@@ -114,8 +114,9 @@ func doRun(args []string, stdOut io.Writer, stdErr logging.Writer, exit func(cod
 	var help bool
 	flags.BoolVar(&help, "h", false, "print usage")
 
-	var interp bool
-	flags.BoolVar(&interp, "interp", false, "force interpreter")
+	var useInterpreter bool
+	flags.BoolVar(&useInterpreter, "interpreter", false,
+		"interprets WebAssembly modules instead of compiling them into native code.")
 
 	var envs sliceFlag
 	flags.Var(&envs, "env", "key=value pair of environment variable to expose to the binary. "+
@@ -180,7 +181,7 @@ func doRun(args []string, stdOut io.Writer, stdErr logging.Writer, exit func(cod
 	ctx := maybeHostLogging(context.Background(), logging.LogScopes(hostlogging), stdErr)
 
 	var rtc wazero.RuntimeConfig
-	if interp {
+	if useInterpreter {
 		rtc = wazero.NewRuntimeConfigInterpreter()
 	} else {
 		rtc = wazero.NewRuntimeConfig()


Test patch:
diff --git a/cmd/wazero/wazero_test.go b/cmd/wazero/wazero_test.go
index 90eb2f91..f59899d6 100644
--- a/cmd/wazero/wazero_test.go
+++ b/cmd/wazero/wazero_test.go
@@ -232,6 +232,12 @@ func TestRun(t *testing.T) {
 			wazeroOpts:     []string{"--env=ANIMAL=bear", "--env=FOOD=sushi"},
 			expectedStdout: "ANIMAL=bear\x00FOOD=sushi\x00",
 		},
+		{
+			name:           "interpreter",
+			wasm:           wasmWasiArg,
+			wazeroOpts:     []string{"--interpreter"}, // just test it works
+			expectedStdout: "test.wasm\x00",
+		},
 		{
 			name:           "wasi",
 			wasm:           wasmWasiFd,
Repository: tetratelabs/wazero
Pull request #1228 (2023-03-13 08:08:55)

dirfs: corrects path joining bug when mounting root
Before, we created invalid directory paths when the host directory was "/", and now we don't!

This brings tests left failing on GOOS=js to 7
```bash
$ wazero run -mount=/:/ --experimental-workdir=$(go env GOROOT)/src/os os.wasm| grep '^--- FAIL'|wc -l
       7
```

See #1222

codefromthecrypt: windows again.. heh ok fine :D

Patch:
diff --git a/internal/sysfs/dirfs.go b/internal/sysfs/dirfs.go
index a02d2c15..81281780 100644
--- a/internal/sysfs/dirfs.go
+++ b/internal/sysfs/dirfs.go
@@ -16,7 +16,7 @@ func NewDirFS(dir string) FS {
 }
 
 func ensureTrailingPathSeparator(dir string) string {
-	if dir[len(dir)-1] != os.PathSeparator {
+	if !os.IsPathSeparator(dir[len(dir)-1]) {
 		return dir + string(os.PathSeparator)
 	}
 	return dir
@@ -139,6 +139,9 @@ func (d *dirFS) Truncate(path string, size int64) error {
 func (d *dirFS) join(path string) string {
 	switch path {
 	case "", ".", "/":
+		if d.cleanedDir == "/" {
+			return "/"
+		}
 		// cleanedDir includes an unnecessary delimiter for the root path.
 		return d.cleanedDir[:len(d.cleanedDir)-1]
 	}


Test patch:
diff --git a/internal/sysfs/dirfs_test.go b/internal/sysfs/dirfs_test.go
index 67019698..07576113 100644
--- a/internal/sysfs/dirfs_test.go
+++ b/internal/sysfs/dirfs_test.go
@@ -39,6 +39,20 @@ func TestNewDirFS(t *testing.T) {
 	})
 }
 
+func TestDirFS_join(t *testing.T) {
+	testFS := NewDirFS("/").(*dirFS)
+	require.Equal(t, "/", testFS.join(""))
+	require.Equal(t, "/", testFS.join("."))
+	require.Equal(t, "/", testFS.join("/"))
+	require.Equal(t, "/tmp", testFS.join("tmp"))
+
+	testFS = NewDirFS(".").(*dirFS)
+	require.Equal(t, ".", testFS.join(""))
+	require.Equal(t, ".", testFS.join("."))
+	require.Equal(t, ".", testFS.join("/"))
+	require.Equal(t, "."+string(os.PathSeparator)+"tmp", testFS.join("tmp"))
+}
+
 func TestDirFS_String(t *testing.T) {
 	testFS := NewDirFS(".")
Repository: tetratelabs/wazero
Pull request #1238 (2023-03-14 05:03:31)

cli: exposes all hostlogging scope


Patch:
diff --git a/cmd/wazero/wazero.go b/cmd/wazero/wazero.go
index ac2a8d4a..03577f5b 100644
--- a/cmd/wazero/wazero.go
+++ b/cmd/wazero/wazero.go
@@ -152,7 +152,7 @@ func doRun(args []string, stdOut io.Writer, stdErr logging.Writer, exit func(cod
 	var hostlogging logScopesFlag
 	flags.Var(&hostlogging, "hostlogging",
 		"a comma-separated list of host function scopes to log to stderr. "+
-			"This may be specified multiple times. Supported values: clock,exit,filesystem,memory,poll,random")
+			"This may be specified multiple times. Supported values: all,clock,filesystem,memory,proc,poll,random")
 
 	cacheDir := cacheDirFlag(flags)
 
@@ -448,14 +448,16 @@ func (f *logScopesFlag) Set(input string) error {
 		switch s {
 		case "":
 			continue
+		case "all":
+			*f |= logScopesFlag(logging.LogScopeAll)
 		case "clock":
 			*f |= logScopesFlag(logging.LogScopeClock)
-		case "proc":
-			*f |= logScopesFlag(logging.LogScopeProc)
 		case "filesystem":
 			*f |= logScopesFlag(logging.LogScopeFilesystem)
 		case "memory":
 			*f |= logScopesFlag(logging.LogScopeMemory)
+		case "proc":
+			*f |= logScopesFlag(logging.LogScopeProc)
 		case "poll":
 			*f |= logScopesFlag(logging.LogScopePoll)
 		case "random":


Test patch:
diff --git a/cmd/wazero/wazero_test.go b/cmd/wazero/wazero_test.go
index 89a89901..27e79233 100644
--- a/cmd/wazero/wazero_test.go
+++ b/cmd/wazero/wazero_test.go
@@ -295,6 +295,16 @@ func TestRun(t *testing.T) {
 			wasmArgs:       []string{"/animals/bear.txt"},
 			expectedStdout: "pooh\n",
 		},
+		{
+			name:       "wasi hostlogging=all",
+			wasm:       wasmWasiRandomGet,
+			wazeroOpts: []string{"--hostlogging=all"},
+			expectedStderr: `--> .$1()
+	==> wasi_snapshot_preview1.random_get(buf=0,buf_len=1000)
+	<== errno=ESUCCESS
+<--
+`,
+		},
 		{
 			name:       "wasi hostlogging=proc",
 			wasm:       wasmCatTinygo,
@@ -657,6 +667,11 @@ func Test_logScopesFlag(t *testing.T) {
 			values:   []string{""},
 			expected: logging.LogScopeNone,
 		},
+		{
+			name:     "all",
+			values:   []string{"all"},
+			expected: logging.LogScopeAll,
+		},
 		{
 			name:     "clock",
 			values:   []string{"clock"},
@@ -692,6 +707,11 @@ func Test_logScopesFlag(t *testing.T) {
 			values:   []string{"clock,filesystem", "poll,random"},
 			expected: logging.LogScopeClock | logging.LogScopeFilesystem | logging.LogScopePoll | logging.LogScopeRandom,
 		},
+		{
+			name:     "all random",
+			values:   []string{"all", "random"},
+			expected: logging.LogScopeAll,
+		},
 	}
 
 	for _, tt := range tests {
Repository: tetratelabs/wazero
Pull request #1260 (2023-03-20 10:28:23)

Removes redundant exit code check
realized that the check at the function preamble is not necessary to prevent the infinite loop,
as there's already a guard to check call stack overflow on that point.


Patch:
diff --git a/internal/wazeroir/compiler.go b/internal/wazeroir/compiler.go
index 6ca4ac9b..60a4609b 100644
--- a/internal/wazeroir/compiler.go
+++ b/internal/wazeroir/compiler.go
@@ -380,10 +380,6 @@ func compile(enabledFeatures api.CoreFeatures,
 		kind:      controlFrameKindFunction,
 	})
 
-	if c.ensureTermination {
-		c.emit(OperationBuiltinFunctionCheckExitCode{})
-	}
-
 	// Now, enter the function body.
 	for !c.controlFrames.empty() && c.pc < uint64(len(c.body)) {
 		if err := c.handleInstruction(); err != nil {


Test patch:
diff --git a/internal/wazeroir/compiler_test.go b/internal/wazeroir/compiler_test.go
index 9407e7c0..b4bc485b 100644
--- a/internal/wazeroir/compiler_test.go
+++ b/internal/wazeroir/compiler_test.go
@@ -3160,7 +3160,6 @@ func Test_ensureTermination(t *testing.T) {
 		{
 			ensureTermination: true,
 			exp: `.entrypoint
-	BuiltinFunctionCheckExitCode
 	ConstI32 0x0
 	Br .L2
 .L2
Repository: tetratelabs/wazero
Pull request #1286 (2023-03-24 17:21:01)

fixes nil panic on close
The last PR over-solved the WASI close problem as it special cased both "_start", used by WASI, and the start section (wasm level) which isn't used by WASI. In the latter case, we ended up returning nil for both the module *and* the error result. We should never do that.. If we coerce exit error zero to nil, we have to return a non-nil module, even if it is unusable as otherwise code like `defer mod.Close(ctx)` will panic.

Note: it would be entirely rare that someone would define a start section and call close in it. This is just something I noticed while looking carefully at the logic.


Patch:
diff --git a/runtime.go b/runtime.go
index ba34a324..47895061 100644
--- a/runtime.go
+++ b/runtime.go
@@ -308,11 +308,6 @@ func (r *runtime) InstantiateModule(
 		if code.closeWithModule {
 			_ = code.Close(ctx) // don't overwrite the error
 		}
-		if se, ok := err.(*sys.ExitError); ok {
-			if se.ExitCode() == 0 { // Don't err on success.
-				err = nil
-			}
-		}
 		return
 	}
 


Test patch:
diff --git a/runtime_test.go b/runtime_test.go
index 331d6026..a7158d8c 100644
--- a/runtime_test.go
+++ b/runtime_test.go
@@ -478,8 +478,9 @@ func TestRuntime_InstantiateModule_ExitError(t *testing.T) {
 		expectedErr error
 	}{
 		{
-			name:     "start: exit code 0",
-			exitCode: 0,
+			name:        "start: exit code 0",
+			exitCode:    0,
+			expectedErr: sys.NewExitError(0),
 		},
 		{
 			name:        "start: exit code 2",
@@ -531,11 +532,16 @@ func TestRuntime_InstantiateModule_ExitError(t *testing.T) {
 			binary := binaryencoding.EncodeModule(mod)
 
 			// Instantiate the module, which calls the start function.
-			_, err = r.InstantiateWithConfig(testCtx, binary,
+			m, err := r.InstantiateWithConfig(testCtx, binary,
 				NewModuleConfig().WithName("call-exit"))
 
 			// Ensure the exit error propagated and didn't wrap.
 			require.Equal(t, tc.expectedErr, err)
+
+			// Ensure calling close again doesn't break
+			if err == nil {
+				require.NoError(t, m.Close(testCtx))
+			}
 		})
 	}
 }
Repository: tetratelabs/wazero
Pull request #1313 (2023-03-30 02:27:51)

sys/error: handle errors.Is for common context use-cases
When I saw the text formatted error, I immediately tried to use `errors.Is` to discard the error (since I called the cancel func) and wasn't able to.  This should make it more natural to handle these special exit code errors.


Patch:
diff --git a/sys/error.go b/sys/error.go
index 9aea47b1..c3efbad9 100644
--- a/sys/error.go
+++ b/sys/error.go
@@ -73,5 +73,11 @@ func (e *ExitError) Is(err error) bool {
 	if target, ok := err.(*ExitError); ok {
 		return e.exitCode == target.exitCode
 	}
+	if e.exitCode == ExitCodeContextCanceled && err == context.Canceled {
+		return true
+	}
+	if e.exitCode == ExitCodeDeadlineExceeded && err == context.DeadlineExceeded {
+		return true
+	}
 	return false
 }


Test patch:
diff --git a/sys/error_test.go b/sys/error_test.go
index b1b278c6..bbf60755 100644
--- a/sys/error_test.go
+++ b/sys/error_test.go
@@ -1,6 +1,7 @@
 package sys
 
 import (
+	"context"
 	"errors"
 	"testing"
 
@@ -55,11 +56,13 @@ func TestExitError_Error(t *testing.T) {
 		err := NewExitError(ExitCodeDeadlineExceeded)
 		require.Equal(t, ExitCodeDeadlineExceeded, err.ExitCode())
 		require.EqualError(t, err, "module closed with context deadline exceeded")
+		require.ErrorIs(t, err, context.DeadlineExceeded, "exit code context deadline exceeded should work")
 	})
 	t.Run("cancel", func(t *testing.T) {
 		err := NewExitError(ExitCodeContextCanceled)
 		require.Equal(t, ExitCodeContextCanceled, err.ExitCode())
 		require.EqualError(t, err, "module closed with context canceled")
+		require.ErrorIs(t, err, context.Canceled, "exit code context canceled should work")
 	})
 	t.Run("normal", func(t *testing.T) {
 		err := NewExitError(123)
Repository: tetratelabs/wazero
Pull request #91 (2021-12-24 05:12:48)

Uses authoritative name for token String()


Patch:
diff --git a/wasm/wat/token.go b/wasm/wat/token.go
index ddfc73da..5d9ae11d 100644
--- a/wasm/wat/token.go
+++ b/wasm/wat/token.go
@@ -68,7 +68,7 @@ const (
 
 	// tokenID is a sequence of idChar characters prefixed by a '$':
 	//
-	// For example, in the below, '$y' is an id:
+	// For example, in the below, '$y' is an ID:
 	//		local.get $y
 	//		i32.const 6
 	//		i32.lt_s
@@ -91,17 +91,18 @@ const (
 )
 
 // tokenNames is index-coordinated with tokenType
+// See https://www.w3.org/TR/wasm-core-1/#tokens%E2%91%A0 for the naming choices.
 var tokenNames = [...]string{
-	"tokenInvalid",
-	"tokenKeyword",
-	"tokenUN",
-	"tokenSN",
-	"tokenFN",
-	"tokenString",
-	"tokenID",
-	"tokenLParen",
-	"tokenRParen",
-	"tokenReserved",
+	"invalid",
+	"keyword",
+	"uN",
+	"sN",
+	"fN",
+	"string",
+	"id",
+	"(",
+	")",
+	"reserved",
 }
 
 // String returns the string name of this token.


Test patch:
diff --git a/wasm/wat/token_test.go b/wasm/wat/token_test.go
index a8aa111e..50a3aad2 100644
--- a/wasm/wat/token_test.go
+++ b/wasm/wat/token_test.go
@@ -11,15 +11,15 @@ func TestTokenType_String(t *testing.T) {
 		input    tokenType
 		expected string
 	}{
-		{tokenKeyword, "tokenKeyword"},
-		{tokenUN, "tokenUN"},
-		{tokenSN, "tokenSN"},
-		{tokenFN, "tokenFN"},
-		{tokenString, "tokenString"},
-		{tokenID, "tokenID"},
-		{tokenLParen, "tokenLParen"},
-		{tokenRParen, "tokenRParen"},
-		{tokenReserved, "tokenReserved"},
+		{tokenKeyword, "keyword"},
+		{tokenUN, "uN"},
+		{tokenSN, "sN"},
+		{tokenFN, "fN"},
+		{tokenString, "string"},
+		{tokenID, "id"},
+		{tokenLParen, "("},
+		{tokenRParen, ")"},
+		{tokenReserved, "reserved"},
 	}
 
 	for _, tt := range tests {