rcheck 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -69,8 +69,9 @@ module RCheck
69
69
  def introspection
70
70
  args = @right.map(&:inspect).join(', ')
71
71
  @left.inspect + case @op
72
- when *%i(== === < > <= >= ~= <=>) then " #{@op} #{args}"
73
- when :[] then "[#{args}]"
72
+ when :==, :===, :<, :>, :<=, :>=, :"~=", :<=>
73
+ " #{@op} #{args}"
74
+ when :[] then "[#{args}]"
74
75
  when :[]=
75
76
  "[#{@right.first.inspect}] = "\
76
77
  "#{@right[1..-1].map(&:inspect).join(', ')}"
@@ -10,7 +10,7 @@ module RCheck
10
10
  end
11
11
 
12
12
  class Line
13
- attr_reader(*%i(file line))
13
+ attr_reader :file, :line
14
14
  def initialize(str)
15
15
  @file, @line, @scope = str.split(':')
16
16
  @line = line.to_i
@@ -4,8 +4,8 @@ module RCheck
4
4
 
5
5
  def root() RCheck::ROOT_SUITE end
6
6
 
7
- def_delegators(:root, *%i(suite [] severity))
8
- def_delegators(Command, *%i(define invoke!))
7
+ def_delegators(:root, :suite, :[], :severity)
8
+ def_delegators(Command, :define, :invoke!)
9
9
 
10
10
  def version
11
11
  "RCheck #{VERSION} @ Ruby #{RUBY_VERSION}"
@@ -44,7 +44,7 @@ module RCheck
44
44
  end
45
45
  end
46
46
 
47
- attr_reader(*%i(name desc implied_commands config))
47
+ attr_reader :name, :desc, :implied_commands, :config
48
48
 
49
49
  def initialize(name, desc, *args)
50
50
  @name = name # if this is a named command definition
@@ -85,7 +85,7 @@ module RCheck
85
85
  end
86
86
 
87
87
  def dispatch
88
- %i(pry how).each do |option|
88
+ [:pry, :how].each do |option|
89
89
  return send option if Conf[option]
90
90
  end
91
91
  run_tests
@@ -110,9 +110,9 @@ module RCheck
110
110
  Colors.cputs :quiet, Array(self[:headers]).map(&:call)
111
111
  puts if self[:progress].any?
112
112
  require_test_files
113
- %i(progress report).each {|v| make_space v }
113
+ [:progress, :report].each {|v| make_space v }
114
114
  suite.report!
115
- exit %i(pass pending).include?(suite.severity(:total)) ?
115
+ exit [:pass, :pending].include?(suite.severity(:total)) ?
116
116
  self[:success_code] : self[:fail_code]
117
117
  end
118
118
 
@@ -11,7 +11,7 @@ module RCheck
11
11
  end
12
12
 
13
13
  class Debugger
14
- attr_reader(*%i(items backtrace))
14
+ attr_reader :items, :backtrace
15
15
 
16
16
  def initialize(*items)
17
17
  @items = items
@@ -1,5 +1,5 @@
1
1
  module RCheck
2
- Command.hide %i(_base _default)
2
+ Command.hide [:_base, :_default]
3
3
 
4
4
  define :_base, 'used as a base for all other commands', Options::BASE
5
5
  define :_default, 'used when nothing else given', Options::DEFAULT
@@ -20,8 +20,8 @@ module RCheck
20
20
  :quiet, report: 'numbers'
21
21
 
22
22
  # define(:html,
23
- # progress_printers: %i(),
24
- # report_printers: %i(Html)
23
+ # progress_printers: [],
24
+ # report_printers: [:Html]
25
25
  # )
26
26
 
27
27
  define :itself, 'run RCheck\'s own test suite',
data/lib/rcheck/dsl.rb CHANGED
@@ -7,7 +7,8 @@ module RCheck
7
7
  end
8
8
  extend Forwardable
9
9
  def_delegators(:@__suite__,
10
- *%i(suite assert refute assert_safe assert_raises debug pending))
10
+ :suite, :assert, :refute, :assert_safe,
11
+ :assert_raises, :debug, :pending)
11
12
 
12
13
  def respond_to?(name)
13
14
  super || @__suite__.parent && @__suite__.parent.scope.respond_to?(name)
@@ -7,9 +7,11 @@ module RCheck
7
7
  end
8
8
  end
9
9
 
10
+ BARCHAR = RUBY_VERSION >= "2.0.0" ? 220.chr : "."
11
+
10
12
  class Bar
11
13
  def report(assertion)
12
- Colors.cprint assertion.status, '▄' if STDOUT.tty?
14
+ Colors.cprint assertion.status, BARCHAR if STDOUT.tty?
13
15
  end
14
16
  end
15
17
  end
@@ -35,15 +35,15 @@ module RCheck
35
35
  end
36
36
  cputs :quiet, indent(item.backtrace)
37
37
 
38
- if %i(error fail).include?(item.status)
38
+ if [:error, :fail].include?(item.status)
39
39
  item.info.each do |dbg|
40
40
  cputs :quiet, dbg_indent(dbg)
41
41
  end
42
42
  end
43
43
  end
44
44
 
45
- if suite.total(*%i(error fail)).any?
46
- end
45
+ # if suite.total(:error, :fail).any?
46
+ # end
47
47
 
48
48
  suite.children.each do |child_suite|
49
49
  report child_suite
@@ -56,8 +56,10 @@ module RCheck
56
56
  Array(lines).map {|line| (' ' * 11) + line.to_s }
57
57
  end
58
58
 
59
+ ARR = RUBY_VERSION >= "2.0.0" ? 175.chr : ">" # double right arrow
60
+
59
61
  def dbg_indent(lines)
60
- Array(lines).map {|line| ' » ' + line.to_s }
62
+ Array(lines).map {|line| " #{ARR} " + line.to_s }
61
63
  end
62
64
  end
63
65
 
@@ -101,14 +103,14 @@ module RCheck
101
103
 
102
104
  class Numbers < Abstract
103
105
  def report(suite)
104
- %i(error fail pending pass).each do |status|
106
+ [:error, :fail, :pending, :pass].each do |status|
105
107
  items = suite.total(status)
106
108
  if items.any?
107
109
  cputs status, "%9d %s" % [items.count, status.to_s.capitalize]
108
110
  end
109
111
  end
110
112
  print '%9d Assertions' %
111
- [suite.total(*%i(pass fail pending)).count]
113
+ [suite.total(:pass, :fail, :pending).count]
112
114
  if suite.total(:error).any?
113
115
  cprint :quiet, ' (not accurate)'
114
116
  end
data/lib/rcheck/suite.rb CHANGED
@@ -4,9 +4,9 @@ module RCheck
4
4
  include Debugging::SuiteMethods
5
5
 
6
6
  SYNONYMS = {
7
- all: %i(error fail pending pass),
8
- problematic: %i(error fail pending),
9
- critical: %i(error fail)
7
+ all: [:error, :fail, :pending, :pass],
8
+ problematic: [:error, :fail, :pending],
9
+ critical: [:error, :fail,]
10
10
  }
11
11
 
12
12
  def initialize(parent, name)
@@ -19,7 +19,7 @@ module RCheck
19
19
  progress: false, status: :pass, location: [full_name])
20
20
  end
21
21
 
22
- attr_reader(*%i(parent name scope assertions result))
22
+ attr_reader :parent, :name, :scope, :assertions, :result
23
23
 
24
24
  def inspect
25
25
  "#<#{self.class}: #{full_name.inspect}>"
@@ -100,13 +100,13 @@ module RCheck
100
100
  end
101
101
 
102
102
  def counts(scope)
103
- Hash[%i(error fail pending pass).map do |sym|
103
+ Hash[[:error, :fail, :pending, :pass].map do |sym|
104
104
  [sym, send(scope, sym).count]
105
105
  end]
106
106
  end
107
107
 
108
108
  def severity(scope)
109
- %i(error fail pending).each do |severity|
109
+ [:error, :fail, :pending].each do |severity|
110
110
  return severity if send(scope, severity).any?
111
111
  end
112
112
  :pass
@@ -1,3 +1,3 @@
1
1
  module RCheck
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -30,7 +30,7 @@ RCheck 'RCheck/ClassMethods' do
30
30
  end
31
31
 
32
32
  suite :severity do
33
- %i(local total subtree).each do |scope|
33
+ [:local, :total, :subtree].each do |scope|
34
34
  assert RCheck.severity(scope), :is_a?, Symbol
35
35
  end
36
36
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rcheck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Jostein Berre Eliassen
@@ -13,43 +14,49 @@ dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - "~>"
19
+ - - ~>
18
20
  - !ruby/object:Gem::Version
19
21
  version: '1.10'
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - "~>"
27
+ - - ~>
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1.10'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rake
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - "~>"
35
+ - - ~>
32
36
  - !ruby/object:Gem::Version
33
37
  version: '10.0'
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - "~>"
43
+ - - ~>
39
44
  - !ruby/object:Gem::Version
40
45
  version: '10.0'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: pry
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - ">="
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - ">="
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  description: Tests that are very simple, useful and quick
@@ -59,7 +66,7 @@ executables:
59
66
  extensions: []
60
67
  extra_rdoc_files: []
61
68
  files:
62
- - ".gitignore"
69
+ - .gitignore
63
70
  - Gemfile
64
71
  - Gemfile.lock
65
72
  - README.md
@@ -95,25 +102,26 @@ files:
95
102
  - tests/sanity.rb
96
103
  homepage: https://github.com/jbe/rcheck
97
104
  licenses: []
98
- metadata: {}
99
105
  post_install_message:
100
106
  rdoc_options: []
101
107
  require_paths:
102
108
  - lib
103
109
  required_ruby_version: !ruby/object:Gem::Requirement
110
+ none: false
104
111
  requirements:
105
- - - ">="
112
+ - - ! '>='
106
113
  - !ruby/object:Gem::Version
107
114
  version: '0'
108
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
+ none: false
109
117
  requirements:
110
- - - ">="
118
+ - - ! '>='
111
119
  - !ruby/object:Gem::Version
112
120
  version: '0'
113
121
  requirements: []
114
122
  rubyforge_project:
115
- rubygems_version: 2.4.5
123
+ rubygems_version: 1.8.23.2
116
124
  signing_key:
117
- specification_version: 4
125
+ specification_version: 3
118
126
  summary: RCheck < RSpec
119
127
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: db2b815fb1dba30c7de1c16a7c01f889e0743136
4
- data.tar.gz: 085cedf81b658fad89957c4fb5cef098d29bdac6
5
- SHA512:
6
- metadata.gz: f6e9311dfe285e0a3762e92c2c30705ae0e7892350806066afb02f5044a73d2e5eccdce82e7832b03c0d4f1ce9a7b9f1ca8c3fbed3c705125add28bd41e7ab6a
7
- data.tar.gz: 07fcfc75690e0b841dd9c9ad0093bb2344f540959ddc173d81d76f50028f055a8bbf77092f53ff89775cd032f0f45272cf01428427f9ec2443e854687abe5f6f