mrubyc-test 0.8.1 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +15 -15
- data/lib/mrubyc/test/config.rb +11 -2
- data/lib/mrubyc/test/generator/attribute.rb +2 -0
- data/lib/mrubyc/test/generator/double.rb +1 -1
- data/lib/mrubyc/test/init.rb +1 -1
- data/lib/mrubyc/test/version.rb +1 -1
- data/lib/mrubyc-ext/mrubyc_test_case.rb +1 -1
- data/lib/mrubyc-ext/object.rb +1 -1
- data/lib/mrubyc-test.rb +13 -20
- data/lib/templates/test.rb.erb +3 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c2c1ac385aec3bdb805561369a159e2b6a7fccd3e3c9824234f679b6b23f2d2
|
4
|
+
data.tar.gz: c9da9ec4950f095143b972fdbd27c5c15917154df4cd7b0d830ff165bc1e7832
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e9c543b901eafef78ba2f59990b1ba73cea291ee0d0707213cc453c6e8001351bc242be01312a0f78e7add437603743a1014f27147e9943dd404718e94dabfa
|
7
|
+
data.tar.gz: f3354b157421e9ca219779f356947d8089e002834ad70ced4ef82b91191d4f6daacfc8073b7bd40b0bb8ca00d16adadaf765cd834c9a1efe19f746db7c33e82a
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mrubyc-test (0.
|
4
|
+
mrubyc-test (0.9.1)
|
5
5
|
activesupport (~> 7.0)
|
6
6
|
rufo (~> 0.12)
|
7
7
|
thor (~> 1.2)
|
@@ -9,7 +9,7 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (7.0.
|
12
|
+
activesupport (7.0.4)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 1.6, < 2)
|
15
15
|
minitest (>= 5.1)
|
@@ -18,24 +18,24 @@ GEM
|
|
18
18
|
diff-lcs (1.5.0)
|
19
19
|
i18n (1.12.0)
|
20
20
|
concurrent-ruby (~> 1.0)
|
21
|
-
minitest (5.16.
|
21
|
+
minitest (5.16.3)
|
22
22
|
rake (13.0.6)
|
23
|
-
rspec (3.
|
24
|
-
rspec-core (~> 3.
|
25
|
-
rspec-expectations (~> 3.
|
26
|
-
rspec-mocks (~> 3.
|
27
|
-
rspec-core (3.
|
28
|
-
rspec-support (~> 3.
|
29
|
-
rspec-expectations (3.
|
23
|
+
rspec (3.12.0)
|
24
|
+
rspec-core (~> 3.12.0)
|
25
|
+
rspec-expectations (~> 3.12.0)
|
26
|
+
rspec-mocks (~> 3.12.0)
|
27
|
+
rspec-core (3.12.0)
|
28
|
+
rspec-support (~> 3.12.0)
|
29
|
+
rspec-expectations (3.12.1)
|
30
30
|
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
-
rspec-support (~> 3.
|
32
|
-
rspec-mocks (3.
|
31
|
+
rspec-support (~> 3.12.0)
|
32
|
+
rspec-mocks (3.12.1)
|
33
33
|
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
-
rspec-support (~> 3.
|
35
|
-
rspec-support (3.
|
34
|
+
rspec-support (~> 3.12.0)
|
35
|
+
rspec-support (3.12.0)
|
36
36
|
rufo (0.13.0)
|
37
37
|
thor (1.2.1)
|
38
|
-
tzinfo (2.0.
|
38
|
+
tzinfo (2.0.5)
|
39
39
|
concurrent-ruby (~> 1.0)
|
40
40
|
|
41
41
|
PLATFORMS
|
data/lib/mrubyc/test/config.rb
CHANGED
@@ -14,6 +14,13 @@ module Mrubyc
|
|
14
14
|
raise 'Check if `Mrubycfile or .mrubycconfig` exists.'
|
15
15
|
end
|
16
16
|
end
|
17
|
+
if config && ENV['MRUBYCFILE']
|
18
|
+
config.each do |k, v|
|
19
|
+
if v && k != "mrbc_path"
|
20
|
+
config[k] = File.join File.dirname(ENV['MRUBYCFILE']), v
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
17
24
|
config || {}
|
18
25
|
end
|
19
26
|
|
@@ -24,9 +31,11 @@ module Mrubyc
|
|
24
31
|
end
|
25
32
|
|
26
33
|
def mrubycfile
|
27
|
-
if
|
34
|
+
if ENV['MRUBYCFILE']
|
35
|
+
ENV['MRUBYCFILE']
|
36
|
+
elsif File.exists? 'Mrubycfile'
|
28
37
|
'Mrubycfile'
|
29
|
-
elsif
|
38
|
+
elsif File.exists? '.mrubycconfig'
|
30
39
|
'.mrubycconfig'
|
31
40
|
else
|
32
41
|
FileUtils.touch 'Mrubycfile'
|
data/lib/mrubyc/test/init.rb
CHANGED
@@ -63,7 +63,7 @@ module Mrubyc
|
|
63
63
|
def init_main_c
|
64
64
|
config = Mrubyc::Test::Config.read(check: false)
|
65
65
|
puts ' cp test/tmp/main.c'
|
66
|
-
erb = ERB.new(File.read(File.expand_path('../../../templates/main.c.erb', __FILE__))
|
66
|
+
erb = ERB.new(File.read(File.expand_path('../../../templates/main.c.erb', __FILE__)))
|
67
67
|
File.write(File.join(config['test_tmp_dir'], 'main.c'), erb.result(binding))
|
68
68
|
|
69
69
|
end
|
data/lib/mrubyc/test/version.rb
CHANGED
data/lib/mrubyc-ext/object.rb
CHANGED
data/lib/mrubyc-test.rb
CHANGED
@@ -48,30 +48,23 @@ module Mrubyc::Test
|
|
48
48
|
puts "cd #{tmp_dir}"
|
49
49
|
puts
|
50
50
|
pwd = Dir.pwd
|
51
|
-
hal_path = "#{pwd}/#{config['mrubyc_src_dir']}/hal"
|
52
|
-
hal_bak_path = "#{pwd}/#{config['mrubyc_src_dir']}/~hal"
|
53
|
-
FileUtils.rm_rf hal_bak_path
|
54
|
-
FileUtils.mv(hal_path, hal_bak_path) if FileTest.exist?(hal_path)
|
55
51
|
exit_code = 0
|
56
52
|
cc = ENV['CC'].to_s.length > 0 ? ENV['CC'] : "gcc"
|
57
53
|
qemu = ENV['QEMU']
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
54
|
+
Dir.chdir(tmp_dir) do
|
55
|
+
[
|
56
|
+
"#{mrbc_path} -B test test.rb",
|
57
|
+
"#{mrbc_path} -B models models.rb",
|
58
|
+
"#{cc} -O0 -g3 -Wall -I #{pwd}/#{config['mrubyc_src_dir']} -static -o test main.c #{pwd}/#{config['mrubyc_src_dir']}/*.c #{pwd}/#{config['mrubyc_src_dir']}/hal_posix/*.c -DMRBC_INT64 -DMAX_SYMBOLS_COUNT=1000 -DMRBC_USE_MATH=1 -DMRBC_USE_HAL_POSIX #{ENV["CFLAGS"]} #{ENV["LDFLAGS"]}",
|
59
|
+
"#{qemu} ./test"
|
60
|
+
].each do |cmd|
|
61
|
+
puts cmd
|
62
|
+
puts
|
63
|
+
unless Kernel.system(cmd)
|
64
|
+
exit_code = 1
|
65
|
+
break
|
70
66
|
end
|
71
67
|
end
|
72
|
-
ensure
|
73
|
-
FileUtils.rm hal_path
|
74
|
-
FileUtils.mv(hal_bak_path, hal_path) if FileTest.exist?(hal_bak_path)
|
75
68
|
end
|
76
69
|
return exit_code
|
77
70
|
end
|
@@ -112,7 +105,7 @@ module Mrubyc::Test
|
|
112
105
|
eg: /home/hoge/mruby/build/host/bin/mrbc
|
113
106
|
RBENV_VERSION will be ignored if you specify this option.
|
114
107
|
DESC
|
115
|
-
def test(testfilepath = "
|
108
|
+
def test(testfilepath = "")
|
116
109
|
Mrubyc::Test::Init.init_main_c
|
117
110
|
init_env
|
118
111
|
config = Mrubyc::Test::Config.read
|
data/lib/templates/test.rb.erb
CHANGED
@@ -43,8 +43,7 @@ def summerize
|
|
43
43
|
puts "Pendings:\n"
|
44
44
|
$pendings.each_with_index do |pending, index|
|
45
45
|
puts $colors[:pending]
|
46
|
-
|
47
|
-
puts ") " + pending[:class_and_method]
|
46
|
+
puts "#{index + 1}) " + pending[:class_and_method]
|
48
47
|
print $colors[:info]
|
49
48
|
puts " # " + pending[:path] + ":" + pending[:line]
|
50
49
|
puts $colors[:reset]
|
@@ -54,8 +53,7 @@ def summerize
|
|
54
53
|
puts "Failures:\n"
|
55
54
|
$failures.each_with_index do |failure, index|
|
56
55
|
puts
|
57
|
-
|
58
|
-
puts ") " + failure[:class_and_method] + " (:" + failure[:assertion] + ")"
|
56
|
+
puts "#{index+1}) " + failure[:class_and_method] + " (:" + failure[:assertion] + ")"
|
59
57
|
print $colors[:failure]
|
60
58
|
puts " description : " + failure[:description]
|
61
59
|
puts " expected : " + failure[:expected] if failure[:expected].length > 0
|
@@ -87,7 +85,7 @@ end
|
|
87
85
|
<% end -%>
|
88
86
|
|
89
87
|
<% test_files.each do |file_name| -%>
|
90
|
-
<%= File.read(file_name)
|
88
|
+
<%= File.read(file_name) -%>
|
91
89
|
<% end -%>
|
92
90
|
|
93
91
|
<% test_cases.each do |test_case| -%>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mrubyc-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HASUMI Hitoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|