Skip to content
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

doc(godoc) Move examples in the root directory… #32

Merged
merged 1 commit into from
Jun 5, 2019
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
6 changes: 3 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ debug-cgo:
test:
#!/usr/bin/env bash
#export DYLD_PRINT_LIBRARIES=y
cd wasmer/test/
cd wasmer
# Run the tests.
GODEBUG=cgocheck=2 go test -test.v $(find . -type f \( -name "*_test.go" \! -name "example_*.go" \! -name "benchmark*.go" \) ) imports.go
GODEBUG=cgocheck=2 go test -test.v $(find test -type f \( -name "*_test.go" \! -name "example_*.go" \! -name "benchmark*.go" \) ) test/imports.go
# Run the short examples.
go test -test.v example_test.go
# Run the long examples.
go test -test.v $(find . -type f \( -name "example_*_test.go" \! -name "example_import_test.go" \) )
go test -test.v $(find . -type f \( -name "example_*_test.go" \! -name "_example_import_test.go" \) )

# Run benchmarks. Subjects can be `wasmer`, `wagon` or `life`. Filter is a regex to select the benchmarks.
bench subject='wagon' filter='.*':
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasmer_test
package wasmertest

// // 1️⃣ Declare the `sum` function signature (see [cgo](https://golang.org/cmd/cgo/)).
//
Expand All @@ -17,7 +17,7 @@ import (

func importWasmFile() string {
_, filename, _, _ := runtime.Caller(0)
return path.Join(path.Dir(filename), "testdata", "examples", "imported_function.wasm")
return path.Join(path.Dir(filename), "test", "testdata", "examples", "imported_function.wasm")
}

// 2️⃣ Write the implementation of the `sum` function, and export it (for cgo).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func greetWasmFile() string {
_, filename, _, _ := runtime.Caller(0)
return path.Join(path.Dir(filename), "testdata", "examples", "greet.wasm")
return path.Join(path.Dir(filename), "test", "testdata", "examples", "greet.wasm")
}

func Example_greet() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func memoryWasmFile() string {
_, filename, _, _ := runtime.Caller(0)
return path.Join(path.Dir(filename), "testdata", "examples", "memory.wasm")
return path.Join(path.Dir(filename), "test", "testdata", "examples", "memory.wasm")
}

func Example_memory() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func simpleWasmFile() string {
_, filename, _, _ := runtime.Caller(0)
return path.Join(path.Dir(filename), "testdata", "examples", "simple.wasm")
return path.Join(path.Dir(filename), "test", "testdata", "examples", "simple.wasm")
}

func Example() {
Expand Down
2 changes: 1 addition & 1 deletion wasmer/test/example_test.go → wasmer/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func GetBytes() []byte {
_, filename, _, _ := runtime.Caller(0)
modulePath := path.Join(path.Dir(filename), "testdata", "tests.wasm")
modulePath := path.Join(path.Dir(filename), "test", "testdata", "tests.wasm")

bytes, _ := wasm.ReadBytes(modulePath)

Expand Down