Skip to content

test: correctly makes all example tests runnable #2281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is useless

This file was deleted.

Loading