Skip to content

Commit

Permalink
Merge pull request #53 from Hywan/test-example
Browse files Browse the repository at this point in the history
test: Test examples
  • Loading branch information
Hywan authored May 21, 2021
2 parents c59fa32 + 9143511 commit d0d4294
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ jobs:
shell: bash
run: |
export PATH="$HOME/.cargo/bin:$PATH"
just test
just test-all
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions crates/wasmer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<h3>
<a href="https://wasmer.io/">Website</a>
<span> • </span>
<a href="https://docs.wasmer.io">Docs</a>
<a href="https://wasmerio.github.io/wasmer-ruby/wasmer_ruby/index.html">Docs</a>
<span> • </span>
<a href="https://slack.wasmer.io/">Slack Channel</a>
</h3>
Expand Down Expand Up @@ -170,11 +170,12 @@ too!

### Testing

Running the `test` recipe will automatically build and run all the
tests. It includes library tests, along with documentation tests.
Running the `test-all` recipe will automatically build and run all the
tests. It includes library tests, along with documentation tests and
the examples:

```sh
$ just test
$ just test-all
```

### Documentation
Expand Down
2 changes: 1 addition & 1 deletion examples/compiler_cranelift.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "./prelude"
require File.expand_path "../prelude", __FILE__

# A Wasm module can be compiled with multiple compilers.
#
Expand Down
2 changes: 1 addition & 1 deletion examples/engine_jit.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "./prelude"
require File.expand_path "../prelude", __FILE__

# Defining an engine in Wasmer is one of the fundamental steps.
#
Expand Down
2 changes: 1 addition & 1 deletion examples/exports_function.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "./prelude"
require File.expand_path "../prelude", __FILE__

# A Wasm module can export entities, like functions, memories,
# globals and tables.
Expand Down
2 changes: 1 addition & 1 deletion examples/exports_global.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding: utf-8
require "./prelude"
require File.expand_path "../prelude", __FILE__

# A Wasm module can export entities, like functions, memories, globals
# and tables.
Expand Down
2 changes: 1 addition & 1 deletion examples/exports_memory.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding: utf-8
require "./prelude"
require File.expand_path "../prelude", __FILE__

# A Wasm module can export entities, like functions, memories,
# globals and tables.
Expand Down
2 changes: 1 addition & 1 deletion examples/imports_function.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding: utf-8
require "./prelude"
require File.expand_path "../prelude", __FILE__

# A Wasm module can import entities, like functions, memories,
# globals and tables.
Expand Down
2 changes: 1 addition & 1 deletion examples/imports_function_early_exit.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding: utf-8
require "./prelude"
require File.expand_path "../prelude", __FILE__

# A Wasm module can import entities, like functions, memories,
# globals and tables.
Expand Down
2 changes: 1 addition & 1 deletion examples/instance.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding: utf-8
require "./prelude"
require File.expand_path "../prelude", __FILE__

# Wasmer will let you easily run WebAssembly module in a Ruby host.
#
Expand Down
2 changes: 1 addition & 1 deletion examples/wasi.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding: utf-8
require "./prelude"
require File.expand_path "../prelude", __FILE__

# Running a WASI compiled WebAssembly module with Wasmer.
#
Expand Down
14 changes: 13 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ build:
rake bundle_install

# Run all the tests.
test:
test-all: test-lib test-doc test-example

# Run the tests of the library.
test-lib:
rake test

# Run the tests of the documentation.
test-doc:
cargo test --manifest-path crates/wasmer/Cargo.toml --doc

# Run the examples as tests.
test-example:
for example in $(ls examples/*.rb); do \
ruby $example; \
done

# Build the `.gem` file.
gem:
rake build
Expand Down

0 comments on commit d0d4294

Please sign in to comment.