mrubyc-test 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0b7fb6ef6a6220b2a6036c4ba3425c3f723ebf5354d9b8683b400d40215e07d
4
- data.tar.gz: 81222c6532836e95f7b605a146136cfebc6f127f85554a121e7c9ac2b33689eb
3
+ metadata.gz: 56675156ca057519416d62929755a348cb2ba1340f7e6ad7a36066e0e2c2bf25
4
+ data.tar.gz: 5f7af355c9bc8760179b84976dcfd6c6be639ddc32cf78dca7c1e3f412f6b2d0
5
5
  SHA512:
6
- metadata.gz: df96b7eccca91fdbf41c01ee891d3b0399226ad72d81219d5241ed3efb77c51230d9530849dd648d2ac820cab3a010e2bd1af510b29906cbeffc7c57a45c373b
7
- data.tar.gz: 77448b29e6bb4186c2f427c2159b0cb19e1cba3035d88ed711b2c16feb60a77906b31a17c65747179f781f5e816351f3ad83f88dde7e2cbc0cd6d56e680e4fbd
6
+ metadata.gz: '09d6b1f937558236961b0543f34b7bfe319ea29719b6f7c844219c04e892627556f99a0dddfc718b9b4b9339869e49cccb5aa9d003e596bb1598ac55d8697f2a'
7
+ data.tar.gz: 3973153063d81e3b0367fab6d265dc47e674f06d799491b5aacc986bc73052c87d181bc8280cd35aa1e3a84ee1be751dee044f435738c4d075ee4e8ecef7abf7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mrubyc-test (0.7.4)
4
+ mrubyc-test (0.9.0)
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.3.1)
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.2)
21
+ minitest (5.16.3)
22
22
  rake (13.0.6)
23
- rspec (3.11.0)
24
- rspec-core (~> 3.11.0)
25
- rspec-expectations (~> 3.11.0)
26
- rspec-mocks (~> 3.11.0)
27
- rspec-core (3.11.0)
28
- rspec-support (~> 3.11.0)
29
- rspec-expectations (3.11.0)
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.11.0)
32
- rspec-mocks (3.11.1)
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.11.0)
35
- rspec-support (3.11.0)
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.4)
38
+ tzinfo (2.0.5)
39
39
  concurrent-ruby (~> 1.0)
40
40
 
41
41
  PLATFORMS
@@ -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 File.exists? 'Mrubycfile'
34
+ if ENV['MRUBYCFILE']
35
+ ENV['MRUBYCFILE']
36
+ elsif File.exists? 'Mrubycfile'
28
37
  'Mrubycfile'
29
- elsif File.exists? '.mrubycconfig'
38
+ elsif File.exists? '.mrubycconfig'
30
39
  '.mrubycconfig'
31
40
  else
32
41
  FileUtils.touch 'Mrubycfile'
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support/core_ext/string/inflections'
4
+ require 'i18n/locale/fallbacks'
5
+ require 'i18n/locale/tag/simple'
4
6
 
5
7
  module Mrubyc
6
8
  module Test
@@ -12,7 +12,7 @@ module Mrubyc
12
12
 
13
13
  def initialize(type, object, location)
14
14
  @type = type
15
- @klass = object.class
15
+ @klass = object.class == Class ? object : object.class
16
16
  @location = location
17
17
  end
18
18
 
@@ -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__)), nil, '-')
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
@@ -1,5 +1,5 @@
1
1
  module Mrubyc
2
2
  module Test
3
- VERSION = "0.8.1"
3
+ VERSION = "0.9.0"
4
4
  end
5
5
  end
@@ -22,7 +22,7 @@ class MrubycTestCase
22
22
  description: @information[:description].to_s,
23
23
  message: message,
24
24
  assertion: assertion.to_s,
25
- expected: expected.to_s,
25
+ expected: expected.to_ss,
26
26
  actual: actual.to_ss,
27
27
  error: error
28
28
  }
@@ -7,7 +7,7 @@ class Object
7
7
  elsif self.class.to_s.end_with? "Error"
8
8
  "#<#{self.class}: #{self.message}>"
9
9
  else
10
- self.to_s + ' [' + self.class_name + ']'
10
+ self.inspect + ' [' + self.class_name + ']'
11
11
  end
12
12
  end
13
13
  def class_name
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
- begin
59
- FileUtils.ln_sf "#{pwd}/#{config['test_tmp_dir']}/hal", "#{pwd}/#{config['mrubyc_src_dir']}/hal"
60
- Dir.chdir(tmp_dir) do
61
- [
62
- "#{mrbc_path} -B test test.rb",
63
- "#{mrbc_path} -B models models.rb",
64
- "#{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/*.c -DMRBC_INT64 -DMAX_SYMBOLS_COUNT=1000 -DMRBC_USE_MATH=1 -DMRBC_USE_HAL_POSIX #{ENV["CFLAGS"]} #{ENV["LDFLAGS"]}",
65
- "#{qemu} ./test"
66
- ].each do |cmd|
67
- puts cmd
68
- puts
69
- exit_code = 1 unless Kernel.system(cmd)
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"]} -Wl,--allow-multiple-definition",
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 = "test/*.rb")
108
+ def test(testfilepath = "")
116
109
  Mrubyc::Test::Init.init_main_c
117
110
  init_env
118
111
  config = Mrubyc::Test::Config.read
@@ -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
- print index # FIXME: picorbc's bug :thinking_face:
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
- print index # FIXME: picorbc's bug :thinking_face:
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
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.8.1
4
+ version: 0.9.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: 2022-07-27 00:00:00.000000000 Z
11
+ date: 2022-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler