Skip to content

Commit

Permalink
Merge #32
Browse files Browse the repository at this point in the history
32: doc(godoc) Move examples in the root directory… r=Hywan a=Hywan

… so that I hope godoc will found them.

Co-authored-by: Ivan Enderlin <[email protected]>
  • Loading branch information
bors[bot] and Hywan committed Jun 5, 2019
2 parents 2dabb45 + 73cc350 commit fa4e858
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
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

0 comments on commit fa4e858

Please sign in to comment.