Skip to content

Commit

Permalink
test: correctly makes all example tests runnable (tetratelabs#2281)
Browse files Browse the repository at this point in the history
Signed-off-by: Takeshi Yoneda <[email protected]>
  • Loading branch information
mathetake authored Jul 6, 2024
1 parent 1734cdb commit d520d9c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ golangci_lint_goarch ?= $(shell go env GOARCH)

.PHONY: lint
lint: $(golangci_lint_path)
@GOARCH=$(golangci_lint_goarch) CGO_ENABLED=0 $(golangci_lint_path) run --timeout 5m
@GOARCH=$(golangci_lint_goarch) CGO_ENABLED=0 $(golangci_lint_path) run --timeout 5m -E testableexamples

.PHONY: format
format:
Expand Down
4 changes: 3 additions & 1 deletion experimental/close_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var ctx context.Context
func Example_closeNotifier() {
closeCh := make(chan struct{})
ctx = experimental.WithCloseNotifier(
ctx,
context.Background(),
experimental.CloseNotifyFunc(func(context.Context, uint32) { close(closeCh) }),
)

Expand All @@ -24,4 +24,6 @@ func Example_closeNotifier() {
default:
// do some more work with the module
}

// Output:
}
6 changes: 6 additions & 0 deletions experimental/sysfs/config_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ func ExampleAdaptFS() {

moduleConfig = wazero.NewModuleConfig().
WithFSConfig(wazero.NewFSConfig().(sysfs.FSConfig).WithSysFSMount(root, "/"))

// Output:
}

// This example shows how to configure a sysfs.DirFS
Expand All @@ -28,6 +30,8 @@ func ExampleDirFS() {

moduleConfig = wazero.NewModuleConfig().
WithFSConfig(wazero.NewFSConfig().(sysfs.FSConfig).WithSysFSMount(root, "/"))

// Output:
}

// This example shows how to configure a sysfs.ReadFS
Expand All @@ -37,4 +41,6 @@ func ExampleReadFS() {

moduleConfig = wazero.NewModuleConfig().
WithFSConfig(wazero.NewFSConfig().(sysfs.FSConfig).WithSysFSMount(readOnly, "/"))

// Output:
}
2 changes: 2 additions & 0 deletions fsconfig_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ func Example_fsConfig() {
moduleConfig = wazero.NewModuleConfig().
// Make "index.html" accessible to the guest as "/index.html".
WithFSConfig(wazero.NewFSConfig().WithFSMount(rooted, "/"))

// Output:
}
38 changes: 0 additions & 38 deletions sys/stat_example_test.go

This file was deleted.

0 comments on commit d520d9c

Please sign in to comment.