mrubyc-test 0.6.1 → 0.7.0.pre.rc0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +10 -10
- data/README.md +9 -5
- data/lib/mrubyc/test/config.rb +14 -4
- data/lib/mrubyc/test/init.rb +2 -2
- data/lib/mrubyc/test/version.rb +1 -1
- data/lib/mrubyc-ext/mrubyc_test_case.rb +2 -2
- data/lib/mrubyc-test.rb +6 -6
- data/lib/templates/test.rb.erb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3999a4b4fc42b7080d1e1923475b9b175c0bfefb9f7438aab342a61d2693de38
|
4
|
+
data.tar.gz: d734e7f81126a95414c4aff68175f57410653a45e15b4b3d72f5a6ef1cc69e9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a28f63efee86b0222ad4c316cf90023fefa18331179f591251d45f5f7145c3bdb102650386a93332869e5bb454f4e8fec6fb5a414233d516e8279aff0a3e6c28
|
7
|
+
data.tar.gz: e8ffe7d3cd5f3414bf91d37a2dcd8f5da9dc79261f9fc733dda0faf085bdca5f13f4c93452b43b583848560cb3fb7aeb10454c8571c0d398e975c984fc84d812
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mrubyc-test (0.6.
|
4
|
+
mrubyc-test (0.6.2)
|
5
5
|
activesupport (~> 6.0)
|
6
6
|
rufo (~> 0.12)
|
7
7
|
thor (~> 1.0)
|
@@ -9,18 +9,18 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (6.1.1)
|
12
|
+
activesupport (6.1.4.1)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 1.6, < 2)
|
15
15
|
minitest (>= 5.1)
|
16
16
|
tzinfo (~> 2.0)
|
17
17
|
zeitwerk (~> 2.3)
|
18
|
-
concurrent-ruby (1.1.
|
18
|
+
concurrent-ruby (1.1.9)
|
19
19
|
diff-lcs (1.4.4)
|
20
|
-
i18n (1.8.
|
20
|
+
i18n (1.8.10)
|
21
21
|
concurrent-ruby (~> 1.0)
|
22
|
-
minitest (5.14.
|
23
|
-
rake (13.0.
|
22
|
+
minitest (5.14.4)
|
23
|
+
rake (13.0.6)
|
24
24
|
rspec (3.10.0)
|
25
25
|
rspec-core (~> 3.10.0)
|
26
26
|
rspec-expectations (~> 3.10.0)
|
@@ -30,12 +30,12 @@ GEM
|
|
30
30
|
rspec-expectations (3.10.1)
|
31
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
32
|
rspec-support (~> 3.10.0)
|
33
|
-
rspec-mocks (3.10.
|
33
|
+
rspec-mocks (3.10.2)
|
34
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
35
35
|
rspec-support (~> 3.10.0)
|
36
|
-
rspec-support (3.10.
|
37
|
-
rufo (0.
|
38
|
-
thor (1.0
|
36
|
+
rspec-support (3.10.2)
|
37
|
+
rufo (0.13.0)
|
38
|
+
thor (1.1.0)
|
39
39
|
tzinfo (2.0.4)
|
40
40
|
concurrent-ruby (~> 1.0)
|
41
41
|
zeitwerk (2.4.2)
|
data/README.md
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
|
5
5
|
mrubyc-test is an unit test framework for [mruby/c](https://github.com/mrubyc/mrubyc), supporting basic assertions, stub and mock.
|
6
6
|
|
7
|
-
##
|
7
|
+
## Dependency
|
8
8
|
|
9
|
-
|
9
|
+
- mrubyc-test 0.7.0+ depends on mrubyc 3.0+
|
10
10
|
|
11
11
|
## Features
|
12
12
|
|
@@ -38,7 +38,7 @@ Or install it yourself as:
|
|
38
38
|
## Usage
|
39
39
|
|
40
40
|
Assuming you are using [mrubyc-utils](https://github.com/hasumikin/mrubyc-utils) to manage your project and [rbenv](https://github.com/rbenv/rbenv) to manage Ruby versions.
|
41
|
-
It means you have
|
41
|
+
It means you have `Mrubycfile` and `.ruby-version` in the top directory of your project.
|
42
42
|
|
43
43
|
Besides, you have to locate mruby model files that are the target of testing like `mrblib/models/class_name.rb`
|
44
44
|
|
@@ -49,8 +49,8 @@ This is an example of ESP32 project:
|
|
49
49
|
```
|
50
50
|
~/your_project $ tree
|
51
51
|
.
|
52
|
-
├──
|
53
|
-
├── .ruby-version
|
52
|
+
├── Mrubycfile # Created by mrubyc-utils
|
53
|
+
├── .ruby-version # It should be mruby's version like 'mruby-3.0.0'
|
54
54
|
├── Makefile
|
55
55
|
├── build
|
56
56
|
├── components
|
@@ -144,6 +144,10 @@ end
|
|
144
144
|
- Other assertions like LT(<), GTE(>=), include?, ...etc.
|
145
145
|
- bla bla bla
|
146
146
|
|
147
|
+
## Acknowledgements
|
148
|
+
|
149
|
+
The API design and implementation of this gem is greatly inspired by [test-unit](https://github.com/test-unit/test-unit). Thank the great work.
|
150
|
+
|
147
151
|
## Contributing
|
148
152
|
|
149
153
|
Bug reports and pull requests are welcome on GitHub at https://github.com/mrubyc/mrubyc-test. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/lib/mrubyc/test/config.rb
CHANGED
@@ -8,21 +8,31 @@ module Mrubyc
|
|
8
8
|
class Config
|
9
9
|
class << self
|
10
10
|
def read(check: true)
|
11
|
-
|
12
|
-
config = YAML.load_file('.mrubycconfig')
|
11
|
+
config = YAML.load_file(mrubycfile)
|
13
12
|
if check
|
14
13
|
if !config || config == [] || !config['test_dir']
|
15
|
-
raise 'Check if
|
14
|
+
raise 'Check if `Mrubycfile or .mrubycconfig` exists.'
|
16
15
|
end
|
17
16
|
end
|
18
17
|
config || {}
|
19
18
|
end
|
20
19
|
|
21
20
|
def write(config)
|
22
|
-
File.open(
|
21
|
+
File.open(mrubycfile, 'r+') do |file|
|
23
22
|
file.write(config.to_yaml)
|
24
23
|
end
|
25
24
|
end
|
25
|
+
|
26
|
+
def mrubycfile
|
27
|
+
if File.exists? 'Mrubycfile'
|
28
|
+
'Mrubycfile'
|
29
|
+
elsif File.exists? '.mrubycconfig'
|
30
|
+
'.mrubycconfig'
|
31
|
+
else
|
32
|
+
FileUtils.touch 'Mrubycfile'
|
33
|
+
'Mrubycfile'
|
34
|
+
end
|
35
|
+
end
|
26
36
|
end
|
27
37
|
end
|
28
38
|
end
|
data/lib/mrubyc/test/init.rb
CHANGED
@@ -11,12 +11,12 @@ module Mrubyc
|
|
11
11
|
puts 'Initializing...'
|
12
12
|
puts
|
13
13
|
|
14
|
-
puts ' touch
|
14
|
+
puts ' touch Mrubycfile'
|
15
15
|
config = Mrubyc::Test::Config.read(check: false)
|
16
16
|
config['test_dir'] = 'test'
|
17
17
|
config['test_tmp_dir'] = 'test/tmp'
|
18
18
|
config['mruby_lib_dir'] = 'mrblib'
|
19
|
-
puts ' add config to
|
19
|
+
puts ' add config to Mrubycfile'
|
20
20
|
Mrubyc::Test::Config.write(config)
|
21
21
|
|
22
22
|
hal_dir = "#{config['test_tmp_dir']}/hal"
|
data/lib/mrubyc/test/version.rb
CHANGED
data/lib/mrubyc-test.rb
CHANGED
@@ -56,9 +56,9 @@ module Mrubyc::Test
|
|
56
56
|
FileUtils.ln_s "#{pwd}/#{config['test_tmp_dir']}/hal", "#{pwd}/#{config['mrubyc_src_dir']}/hal"
|
57
57
|
Dir.chdir(tmp_dir) do
|
58
58
|
[
|
59
|
-
"#{mrbc_path} -
|
60
|
-
"#{mrbc_path} -
|
61
|
-
"cc -O0 -g3 -Wall -I #{pwd}/#{config['mrubyc_src_dir']} -o test main.c #{pwd}/#{config['mrubyc_src_dir']}/*.c #{pwd}/#{config['mrubyc_src_dir']}/hal/*.c #{ENV["CFLAGS"]} #{ENV["LDFLAGS"]}",
|
59
|
+
"#{mrbc_path} -B test test.rb",
|
60
|
+
"#{mrbc_path} -B models models.rb",
|
61
|
+
"cc -O0 -g3 -Wall -I #{pwd}/#{config['mrubyc_src_dir']} -o test main.c #{pwd}/#{config['mrubyc_src_dir']}/*.c #{pwd}/#{config['mrubyc_src_dir']}/hal/*.c -DMRBC_USE_HAL_POSIX #{ENV["CFLAGS"]} #{ENV["LDFLAGS"]}",
|
62
62
|
"./test"].each do |cmd|
|
63
63
|
puts cmd
|
64
64
|
puts
|
@@ -115,15 +115,15 @@ module Mrubyc::Test
|
|
115
115
|
DESC
|
116
116
|
def test(testfilepath = "test/*.rb")
|
117
117
|
init_env
|
118
|
+
config = Mrubyc::Test::Config.read
|
118
119
|
method_name_pattern = (%r{\A/(.*)/\Z} =~ options[:name] ? Regexp.new($1) : options[:name])
|
119
120
|
test_path = if testfilepath == ""
|
120
121
|
File.join(Dir.pwd, config['test_dir'], "*.rb")
|
121
122
|
else
|
122
123
|
File.join(Dir.pwd, testfilepath)
|
123
124
|
end
|
124
|
-
mrbc_path =
|
125
|
-
|
126
|
-
else
|
125
|
+
mrbc_path = options[:mrbc_path] || config['mrbc_path']
|
126
|
+
unless mrbc_path
|
127
127
|
mruby_version = File.read('.ruby-version').gsub("\n", '').chomp
|
128
128
|
unless mruby_version.index('mruby')
|
129
129
|
puts '.ruby-version doesn\'t set `mruby-x.x.x It is recommended to use the latest version of https://github.com/hasumikin/mrubyc-utils`'
|
data/lib/templates/test.rb.erb
CHANGED
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.7.0.pre.rc0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HASUMI Hitoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -148,11 +148,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- - "
|
151
|
+
- - ">"
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version:
|
153
|
+
version: 1.3.1
|
154
154
|
requirements: []
|
155
|
-
rubygems_version: 3.2.
|
155
|
+
rubygems_version: 3.2.17
|
156
156
|
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: Test Framework for mruby/c
|