mrubyc-test 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +30 -20
- data/README.md +4 -4
- data/lib/mrubyc/test/config.rb +2 -2
- data/lib/mrubyc/test/version.rb +1 -1
- data/lib/mrubyc-ext/mrubyc_test_case.rb +1 -1
- data/lib/mrubyc-test.rb +7 -2
- data/lib/templates/test.rb.erb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9937b29f96d18b809a11ea45288cf698c47963717e4956481884814cbcc76ed
|
4
|
+
data.tar.gz: 26e53202803cc57418a5c1146484148fefa091ed7de1dd0494d5196f6ffcfd83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a390896a33e1254b7498f64e4733a8eb60b641cb70931ba414f4f3ff0232ea498223e8e86f270a002192beffce8b8547652c872ecbd94d5c20ed8206a585068
|
7
|
+
data.tar.gz: 37e70def0068c99eb0a7e7ba1e3c5405f4381b561b4915262c5828d627fa62e17f5f84ddad27a0d7576efe5427b33eabafdfa26d081813891cd01f1d986373fe
|
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.10.0)
|
5
5
|
activesupport (~> 7.0)
|
6
6
|
rufo (~> 0.12)
|
7
7
|
thor (~> 1.2)
|
@@ -9,32 +9,42 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (7.
|
12
|
+
activesupport (7.1.3.2)
|
13
|
+
base64
|
14
|
+
bigdecimal
|
13
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
+
connection_pool (>= 2.2.5)
|
17
|
+
drb
|
14
18
|
i18n (>= 1.6, < 2)
|
15
19
|
minitest (>= 5.1)
|
20
|
+
mutex_m
|
16
21
|
tzinfo (~> 2.0)
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
base64 (0.2.0)
|
23
|
+
bigdecimal (3.1.7)
|
24
|
+
concurrent-ruby (1.2.3)
|
25
|
+
connection_pool (2.4.1)
|
26
|
+
diff-lcs (1.5.1)
|
27
|
+
drb (2.2.1)
|
28
|
+
i18n (1.14.4)
|
20
29
|
concurrent-ruby (~> 1.0)
|
21
|
-
minitest (5.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
rspec-
|
26
|
-
rspec-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
+
minitest (5.22.3)
|
31
|
+
mutex_m (0.2.0)
|
32
|
+
rake (13.1.0)
|
33
|
+
rspec (3.13.0)
|
34
|
+
rspec-core (~> 3.13.0)
|
35
|
+
rspec-expectations (~> 3.13.0)
|
36
|
+
rspec-mocks (~> 3.13.0)
|
37
|
+
rspec-core (3.13.0)
|
38
|
+
rspec-support (~> 3.13.0)
|
39
|
+
rspec-expectations (3.13.0)
|
30
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
-
rspec-support (~> 3.
|
32
|
-
rspec-mocks (3.
|
41
|
+
rspec-support (~> 3.13.0)
|
42
|
+
rspec-mocks (3.13.0)
|
33
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
-
rspec-support (~> 3.
|
35
|
-
rspec-support (3.
|
36
|
-
rufo (0.
|
37
|
-
thor (1.
|
44
|
+
rspec-support (~> 3.13.0)
|
45
|
+
rspec-support (3.13.1)
|
46
|
+
rufo (0.17.1)
|
47
|
+
thor (1.3.1)
|
38
48
|
tzinfo (2.0.6)
|
39
49
|
concurrent-ruby (~> 1.0)
|
40
50
|
|
data/README.md
CHANGED
@@ -12,11 +12,11 @@ mrubyc-test is an unit test framework for [mruby/c](https://github.com/mrubyc/mr
|
|
12
12
|
|
13
13
|
- Tests are applicable to class and its instance methods written with mruby
|
14
14
|
- C code will not be covered directly though, you can test your C implementation if you write mruby wrapper class. In this case, your test class (it also written with mruby) will test an integrated circumstance of C and mruby
|
15
|
-
- Tests will run on your PC (POSIX) hereby you can write *business logic* with mruby/c apart from C API matters like
|
15
|
+
- Tests will run on your PC (POSIX) hereby you can write *business logic* with mruby/c apart from C API matters like microcontroller peripherals
|
16
16
|
- Simple assertions ... enough for almost firmware development though, I will increase the number of assertion
|
17
17
|
- Stub ... You can write your mruby code without peripheral implementation by C
|
18
18
|
- Mock ... You can call any method still doesn't exist
|
19
|
-
- The implementation of your application and test code will be analyzed by CRuby program, then
|
19
|
+
- The implementation of your application and test code will be analyzed by CRuby program, then compiled into mruby byte code and executed on mruby/c VM
|
20
20
|
|
21
21
|
## Installation
|
22
22
|
|
@@ -77,7 +77,7 @@ Now you can run test because a sample test code was also created.
|
|
77
77
|
You should get some assertion failures.
|
78
78
|
Take a look at `test/sample_test.rb` to handle the failures and find how to write your own test.
|
79
79
|
|
80
|
-
###
|
80
|
+
### Assertions
|
81
81
|
|
82
82
|
```ruby
|
83
83
|
def assertions
|
@@ -136,7 +136,7 @@ end
|
|
136
136
|
|
137
137
|
## Known problems
|
138
138
|
|
139
|
-
- You have to write stub or mock test
|
139
|
+
- You have to write stub or mock test for all the methods still do not exist otherwise your test won't turn green
|
140
140
|
|
141
141
|
## TODO (possibly)
|
142
142
|
|
data/lib/mrubyc/test/config.rb
CHANGED
@@ -33,9 +33,9 @@ module Mrubyc
|
|
33
33
|
def mrubycfile
|
34
34
|
if ENV['MRUBYCFILE']
|
35
35
|
ENV['MRUBYCFILE']
|
36
|
-
elsif File.
|
36
|
+
elsif File.exist? 'Mrubycfile'
|
37
37
|
'Mrubycfile'
|
38
|
-
elsif File.
|
38
|
+
elsif File.exist? '.mrubycconfig'
|
39
39
|
'.mrubycconfig'
|
40
40
|
else
|
41
41
|
FileUtils.touch 'Mrubycfile'
|
data/lib/mrubyc/test/version.rb
CHANGED
@@ -121,7 +121,7 @@ class MrubycTestCase
|
|
121
121
|
$mock.expected.keys.each do |key|
|
122
122
|
$mock.actual[key] = 0 unless $mock.actual[key]
|
123
123
|
if $mock.expected[key] > $mock.actual[key]
|
124
|
-
failure(:mock, $mock.expected[key], $mock.actual[key], key.to_s + '
|
124
|
+
failure(:mock, $mock.expected[key], $mock.actual[key], key.to_s + ' should have been called at least expected times')
|
125
125
|
else
|
126
126
|
success(:mock, $mock.expected[key], $mock.actual[key])
|
127
127
|
end
|
data/lib/mrubyc-test.rb
CHANGED
@@ -51,11 +51,16 @@ module Mrubyc::Test
|
|
51
51
|
exit_code = 0
|
52
52
|
cc = ENV['CC'].to_s.length > 0 ? ENV['CC'] : "gcc"
|
53
53
|
qemu = ENV['QEMU']
|
54
|
+
mrubyc_src_dir = "#{pwd}/#{config['mrubyc_src_dir']}"
|
55
|
+
hal_dir = File.join(mrubyc_src_dir, '../hal/posix')
|
54
56
|
Dir.chdir(tmp_dir) do
|
55
57
|
[
|
56
58
|
"#{mrbc_path} -B test test.rb",
|
57
59
|
"#{mrbc_path} -B models models.rb",
|
58
|
-
"#{cc} -O0 -g3 -Wall
|
60
|
+
"#{cc} -O0 -g3 -Wall " +
|
61
|
+
"-I #{mrubyc_src_dir} -I #{hal_dir} -static " +
|
62
|
+
"-o test main.c #{mrubyc_src_dir}/*.c #{hal_dir}/*.c " +
|
63
|
+
"-DMRBC_INT64 -DMAX_SYMBOLS_COUNT=10000 -DMRBC_USE_MATH=1 -DMRBC_USE_HAL_POSIX #{ENV["CFLAGS"]} #{ENV["LDFLAGS"]}",
|
59
64
|
"#{qemu} ./test"
|
60
65
|
].each do |cmd|
|
61
66
|
puts cmd
|
@@ -84,7 +89,7 @@ module Mrubyc::Test
|
|
84
89
|
option :every, type: :numeric, default: 10, aliases: "-e",
|
85
90
|
banner: <<~DESC.chomp
|
86
91
|
NUMBER
|
87
|
-
To avoid Out of Memory, test will be
|
92
|
+
To avoid Out of Memory, test will be divided up to
|
88
93
|
every specified NUMBER of xxx_test.rb files
|
89
94
|
DESC
|
90
95
|
option :verbose, type: :boolean, default: false, aliases: "-v",
|
data/lib/templates/test.rb.erb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Generated by gem 'mrubyc_test' version: <%= Mrubyc::Test::VERSION %>
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# Generated at: <%= Time.now %>
|
5
5
|
# Your RUBY_DESCRIPTION: <%= RUBY_DESCRIPTION %>
|
6
6
|
#
|
7
7
|
# For more information, see <%= Gem.loaded_specs['mrubyc-test']&.homepage %>
|
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.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HASUMI Hitoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
|
-
rubygems_version: 3.
|
155
|
+
rubygems_version: 3.6.0.dev
|
156
156
|
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: Test Framework for mruby/c
|