Skip to content

Commit 87d3151

Browse files
author
graial
committed
update types and add test
1 parent 8428908 commit 87d3151

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

‎sig/ruby_wasm/build.rbs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ module RubyWasm
251251
def ar: -> String
252252

253253
def install: (_CommandExecutor executor) -> void
254+
def wasi_sysroot?: -> bool
254255
end
255256

256257
class WASISDK < Toolchain
@@ -268,6 +269,7 @@ module RubyWasm
268269
def download_url: () -> String
269270
def install_wasi_sdk: (_CommandExecutor executor) -> void
270271
def install: (_CommandExecutor executor) -> void
272+
def wasi_sysroot?: -> bool
271273
end
272274

273275
class Binaryen

‎test/toolchain_predicate_test.rb‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require "test-unit"
2+
require_relative "../lib/ruby_wasm/build/toolchain"
3+
# require "bundler"
4+
5+
class ToolchainPredicateTest < Test::Unit::TestCase
6+
def test_base_toolchain_is_not_wasi_sysroot
7+
assert_equal false, Class.new(RubyWasm::Toolchain).allocate.wasi_sysroot?
8+
end
9+
10+
def test_wasi_sdk_is_wasi_sysroot
11+
assert_equal true, Class.new(RubyWasm::WASISDK).allocate.wasi_sysroot?
12+
end
13+
14+
def test_emscripten_is_not_wasi_sysroot
15+
assert_equal false, Class.new(RubyWasm::Emscripten).allocate.wasi_sysroot?
16+
end
17+
end

0 commit comments

Comments
 (0)