Skip to content

Commit 51eb37d

Browse files
committed
Skip some tests on windows
1 parent 9d8978f commit 51eb37d

File tree

11 files changed

+35
-3
lines changed

11 files changed

+35
-3
lines changed

test/call_strcpy.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
mobiruby_test "CFunc::call_strcpy" do
2+
skip if CFunc::Platform.is_win32?
3+
24
ptr = CFunc::Pointer.malloc(12)
35

46
result = CFunc::call(CFunc::Pointer, "strcpy", ptr, "Hello")

test/call_struct1.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ class STest < CFunc::Struct
77
end
88

99
mobiruby_test "CFunc::call_struct1" do
10+
skip if CFunc::Platform.is_win32?
11+
1012
stest = STest.new
1113

1214
assert_equal 10, stest[:x] = 10

test/call_struct2.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class ::STest2 < CFunc::Struct
1414
end
1515

1616
mobiruby_test "CFunc::call_struct2" do
17+
skip if CFunc::Platform.is_win32?
18+
1719
stest2 = ::STest2.new
1820

1921
assert_equal 10, stest2[:s][:x] = 10

test/closure1.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
mobiruby_test "CFunc::closure1" do
2+
skip if CFunc::Platform.is_win32?
3+
24
val = 5
35
callback = CFunc::Closure.new(CFunc::Int, [CFunc::SInt32, CFunc::SInt32]) do |a, b|
46
a.to_i * b.to_i * val

test/closure2.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
mobiruby_test "CFunc::closure2" do
2+
skip if CFunc::Platform.is_win32?
3+
24
compar = CFunc::Closure.new(CFunc::Int, [CFunc::Pointer(CFunc::Int), CFunc::Pointer(CFunc::Int)]) do |a, b|
35
a.refer.to_i - b.refer.to_i
46
end

test/define_cfunc.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
mobiruby_test "CFunc::define_cfunc" do
2+
skip if CFunc::Platform.is_win32?
3+
24
CFunc::define_function CFunc::Pointer, "strcpy", CFunc::Pointer, CFunc::Pointer
35
CFunc::define_function CFunc::Pointer, "strcat"
46
CFunc::define_function CFunc::Int, "cfunc_test_func4", CFunc::Int, CFunc::Int

test/func_pointer.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
mobiruby_test "CFunc::Function pointer" do
2+
skip if CFunc::Platform.is_win32?
3+
24
dlh = CFunc::call(CFunc::Pointer, "dlopen", nil, nil)
35

46
strcpy_ptr = CFunc::call(CFunc::Pointer, "dlsym", dlh, "strcpy")

test/mobitest.rb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
$ok_test, $ko_test, $kill_test = 0, 0, 0
22
$asserts = []
33

4+
class MobiRubyTestSkip < NotImplementedError
5+
end
6+
47
class MobiRubyTest
58
def initialize(label)
69
@label = label
@@ -11,9 +14,14 @@ def run(&block)
1114
begin
1215
instance_eval(&block)
1316
rescue Exception => e
14-
$asserts.push "Error: #{@label} ##{@index} #{e}"
15-
$kill_test += 1
16-
print('X')
17+
if e.class.to_s != 'MobiRubyTestSkip'
18+
$asserts.push "Error: #{@label} ##{@index} #{e}"
19+
$kill_test += 1
20+
print('X')
21+
else
22+
$asserts.push "Skip: #{@label} ##{@index}"
23+
print('?')
24+
end
1725
end
1826
end
1927

@@ -29,6 +37,10 @@ def assert(result, label='')
2937
end
3038
end
3139

40+
def skip
41+
raise MobiRubyTestSkip.new
42+
end
43+
3244
def assert_equal(a, b)
3345
assert(a===b, "<#{a.inspect}> expected but was <#{b.inspect}>")
3446
end

test/pointer.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
mobiruby_test "CFunc::Pointer" do
2+
skip if CFunc::Platform.is_win32?
3+
24
ptr1 = CFunc::Pointer.new
35
assert ptr1.is_null?
46

test/rubyvm.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
mobiruby_test "CFunc::RubyVM" do
2+
skip if CFunc::Platform.is_win32?
3+
24
vm = CFunc::RubyVM.thread('_rubyvm1')
35

46
def sleep(sec)

test/string1.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
mobiruby_test "CFunc::String1" do
2+
skip if CFunc::Platform.is_win32?
3+
24
str = "STRING"
35
ptr = CFunc::Pointer.malloc(7)
46

0 commit comments

Comments
 (0)