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

test: Test examples #53

Merged
merged 5 commits into from
May 21, 2021
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 .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