power_assert 1.1.4 → 2.0.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: 07f2f2b9a7929fed3e16cadeba67319c6e9145c8426d07c4b9294b7f03898a9a
4
- data.tar.gz: 8064ab656664de1990131a17d85acb16ddab86ecff89758bb1733a23eb64abd9
3
+ metadata.gz: 3d3d0e5985a6bb521449ef71f42225297f74cd879017bc0fa9fc43e1c7a612f4
4
+ data.tar.gz: 63dbbb1eb926c54fcefc1fb3933f2a5bd7970d3e98a9074d103d378492581d49
5
5
  SHA512:
6
- metadata.gz: 6152b43a6692614b979763d426f48039f1b428375b2d5a0e9f3d2776f4c5b90129ce439ec0325c2f0dd6d027da2e719a1681b33a9d1b1f3da68fb2df55bf321c
7
- data.tar.gz: 72744598d1a357cea0b4fac9629bdbbc513fdfe8290c6bc4bf5399cbe2f96421172bcf10edc46ebba2f24852ff5d1ce5c3e13e8d3449141a92834dabdfe3f96a
6
+ metadata.gz: 72392cf0e4ab54507b191a3552664531933c554f3aa94883d75cea07b3c37d49c969ec6c06c0ff37b8704e7d7de5b5e500dc251d8de8f17561253e635dfc2f45
7
+ data.tar.gz: f6b2be0b7dfa3e06a6f28bdec0dae7b63150cffc9f47a5499f07ffd94f1cf7b332d5d2b2796946cbddded9931676263a8064874697dbc9ee026e6a05b46eb7f4
@@ -0,0 +1,32 @@
1
+ on: [ push, pull_request ]
2
+
3
+ jobs:
4
+ test:
5
+ name: >-
6
+ Test (${{ matrix.ruby-version }} / ${{ matrix.os }} / TEST_SYMLINK: ${{ matrix.TEST_SYMLINK }})
7
+ strategy:
8
+ fail-fast: false
9
+ matrix:
10
+ ruby-version: [ '3.0', 2.7, 2.6, 2.5, head ]
11
+ os: [ ubuntu-latest, macos-latest ]
12
+ TEST_SYMLINK: [ yes, no ]
13
+ runs-on: ${{ matrix.os }}
14
+ env:
15
+ TEST_SYMLINK: ${{ matrix.TEST_SYMLINK }}
16
+ continue-on-error: ${{ matrix.ruby-version == 'head' }}
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - name: Set up Ruby
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby-version }}
23
+ bundler-cache: true
24
+ - name: Run before_script
25
+ run: |
26
+ bundle exec rake before_script
27
+ - name: Run the test suite
28
+ run: |
29
+ bundle exec rake
30
+ - name: Run after_script
31
+ run: |
32
+ bundle exec rake after_script
@@ -0,0 +1,96 @@
1
+ # power_assert
2
+ ## About
3
+ Power Assert shows each value of variables and method calls in the expression.
4
+ It is useful for testing, providing which value wasn't correct when the condition is not satisfied.
5
+
6
+ Failure:
7
+ assert { 3.times.to_a.include?(3) }
8
+ | | |
9
+ | | false
10
+ | [0, 1, 2]
11
+ #<Enumerator: 3:times>
12
+
13
+ ## Related Projects
14
+ In general, you don't need to use this library directly.
15
+ Use following test frameworks or extensions instead.
16
+
17
+ * [test-unit](https://github.com/test-unit/test-unit)(>= 3.0.0)
18
+ * [Document](http://test-unit.github.io/test-unit/en/Test/Unit/Assertions.html#assert-instance_method)
19
+ * [minitest-power_assert](https://github.com/hsbt/minitest-power_assert)
20
+ * [rspec-power_assert](https://github.com/joker1007/rspec-power_assert)
21
+ * [pry-power_assert](https://github.com/yui-knk/pry-power_assert)
22
+ * [pry-byebug-power_assert](https://github.com/k-tsj/pry-byebug-power_assert)
23
+ * [power_p](https://github.com/k-tsj/power_p)
24
+
25
+ ## Requirement
26
+ * CRuby 2.5+
27
+
28
+ ## Configuration
29
+ To colorize output messages, add <code>require "power_assert/colorize"</code> to your code.
30
+ (It requires CRuby 3.0.1+ or irb 1.3.1+)
31
+
32
+ ## Known Limitations
33
+ * Expressions must be put in one line. Expressions with folded long lines produce nothing report, e.g.:
34
+
35
+ ```ruby
36
+ assert do
37
+ # reported
38
+ func(foo: 0123456789, bar: "abcdefg")
39
+ end
40
+
41
+ assert do
42
+ # won't be reported
43
+ func(foo: 0123456789,
44
+ bar: "abcdefg")
45
+ end
46
+ ```
47
+
48
+ * Expressions must have one or more method call. Expressions with no method call produce nothing report, e.g.:
49
+
50
+ ```ruby
51
+ val = false
52
+ assert do
53
+ # reported
54
+ val == true
55
+ end
56
+
57
+ assert do
58
+ # won't be reported
59
+ val
60
+ end
61
+ ```
62
+
63
+ * Returned values from accessor methods, method missing, or "super" produce nothing report, e.g:
64
+
65
+ ```ruby
66
+ class Foo
67
+ attr_accessor :val
68
+ end
69
+ foo = Foo.new
70
+ foo.val = false
71
+
72
+ assert do
73
+ # reported (only the value of "foo" and the literal "true")
74
+ foo.val == true
75
+ end
76
+
77
+ assert do
78
+ # won't be reported
79
+ foo.val
80
+ end
81
+ ```
82
+
83
+ * Expressions should not have conditional branches. Expressions with such conditional codes may produce nothing report, e.g.:
84
+
85
+ ```ruby
86
+ condition = true
87
+ expected = false
88
+ actual = true
89
+ assert do
90
+ # this will fail but nothing reported
91
+ condition ? expected == actual : expected == actual
92
+ end
93
+ ```
94
+
95
+ ## Reference
96
+ * [Power Assert in Ruby (at RubyKaigi 2014) // Speaker Deck](https://speakerdeck.com/k_tsj/power-assert-in-ruby)
@@ -7,7 +7,7 @@ begin
7
7
  captured = false
8
8
  TracePoint.new(:return, :c_return) do |tp|
9
9
  captured = true
10
- unless tp.binding and tp.return_value
10
+ unless tp.binding and tp.return_value and tp.callee_id
11
11
  raise ''
12
12
  end
13
13
  end.enable { __id__ }
@@ -17,22 +17,15 @@ rescue
17
17
  raise LoadError, 'Fully compatible TracePoint API required'
18
18
  end
19
19
 
20
- require 'power_assert/version'
21
- require 'power_assert/configuration'
22
20
  require 'power_assert/context'
21
+ require 'power_assert/configuration'
22
+ require 'power_assert/version'
23
23
 
24
24
  module PowerAssert
25
25
  POWER_ASSERT_LIB_DIR = File.dirname(caller_locations(1, 1).first.path)
26
26
  INTERNAL_LIB_DIRS = {PowerAssert => POWER_ASSERT_LIB_DIR}
27
27
  private_constant :POWER_ASSERT_LIB_DIR, :INTERNAL_LIB_DIRS
28
28
 
29
- # For backward compatibility
30
- IGNORED_LIB_DIRS = INTERNAL_LIB_DIRS
31
- private_constant :IGNORED_LIB_DIRS
32
- if respond_to?(:deprecate_constant)
33
- deprecate_constant :IGNORED_LIB_DIRS
34
- end
35
-
36
29
  class << self
37
30
  def start(assertion_proc_or_source, assertion_method: nil, source_binding: TOPLEVEL_BINDING)
38
31
  if respond_to?(:clear_global_method_cache, true)
@@ -1,9 +1,7 @@
1
- warn 'power_assert/colorize is experimental'
2
-
3
1
  require 'power_assert/configuration'
4
2
 
5
3
  PowerAssert.configure do |c|
6
4
  c.lazy_inspection = true
7
- c._colorize_message = true
8
- c._use_pp = true
5
+ c.colorize_message = true
6
+ c.inspector = :pp
9
7
  end
@@ -1,7 +1,7 @@
1
1
  module PowerAssert
2
2
  class << self
3
3
  def configuration
4
- @configuration ||= Configuration[false, false, true, false, false]
4
+ @configuration ||= Configuration[false, true, false, :p]
5
5
  end
6
6
 
7
7
  def configure
@@ -9,35 +9,35 @@ module PowerAssert
9
9
  end
10
10
  end
11
11
 
12
- SUPPORT_ALIAS_METHOD = TracePoint.public_method_defined?(:callee_id)
13
- private_constant :SUPPORT_ALIAS_METHOD
14
-
15
- class Configuration < Struct.new(:lazy_inspection, :_trace_alias_method, :_redefinition, :_colorize_message, :_use_pp)
16
- def _trace_alias_method=(bool)
17
- super
18
- if SUPPORT_ALIAS_METHOD
19
- warn 'power_assert: _trace_alias_method option is obsolete. You no longer have to set it.'
20
- end
21
- end
22
-
23
- def _colorize_message=(bool)
12
+ class Configuration < Struct.new(:lazy_inspection, :_redefinition, :colorize_message, :inspector)
13
+ def colorize_message=(bool)
24
14
  if bool
25
- require 'pry'
15
+ require 'irb/color'
16
+ if inspector == :pp
17
+ require 'irb/color_printer'
18
+ end
26
19
  end
27
20
  super
28
21
  end
29
22
 
30
23
  def lazy_inspection=(bool)
31
24
  unless bool
32
- raise 'lazy_inspection option must be enabled when using pp' if _use_pp
25
+ raise 'lazy_inspection option must be enabled when using pp' if inspector == :pp
33
26
  end
34
27
  super
35
28
  end
36
29
 
37
- def _use_pp=(bool)
38
- if bool
30
+ def inspector=(inspector)
31
+ case inspector
32
+ when :pp
39
33
  raise 'lazy_inspection option must be enabled when using pp' unless lazy_inspection
40
34
  require 'pp'
35
+ if colorize_message
36
+ require 'irb/color_printer'
37
+ end
38
+ when :p
39
+ else
40
+ raise ArgumentError, "unknown inspector: #{inspector}"
41
41
  end
42
42
  super
43
43
  end
@@ -12,32 +12,30 @@ module PowerAssert
12
12
  @target_thread = Thread.current
13
13
  method_id_set = nil
14
14
  @return_values = []
15
- trace_alias_method = PowerAssert.configuration._trace_alias_method
16
15
  @trace_return = TracePoint.new(:return, :c_return) do |tp|
17
- begin
18
- unless method_id_set
19
- next unless Thread.current == @target_thread
20
- method_id_set = @parser.method_id_set
21
- end
22
- method_id = SUPPORT_ALIAS_METHOD ? tp.callee_id :
23
- trace_alias_method && tp.event == :return ? tp.binding.eval('::Kernel.__callee__') :
24
- tp.method_id
25
- next if ! method_id_set[method_id]
26
- next if tp.event == :c_return and
27
- not (@parser.lineno == tp.lineno and @parser.path == tp.path)
28
- locs = PowerAssert.app_caller_locations
29
- diff = locs.length - base_caller_length
30
- if (tp.event == :c_return && diff == 1 || tp.event == :return && diff <= 2) and Thread.current == @target_thread
31
- idx = -(base_caller_length + 1)
32
- if @parser.path == locs[idx].path and @parser.lineno == locs[idx].lineno
33
- val = PowerAssert.configuration.lazy_inspection ?
34
- tp.return_value :
35
- InspectedValue.new(SafeInspectable.new(tp.return_value).inspect)
36
- @return_values << Value[method_id.to_s, val, locs[idx].lineno, nil]
37
- end
16
+ unless method_id_set
17
+ next unless Thread.current == @target_thread
18
+ method_id_set = @parser.method_id_set
19
+ end
20
+ method_id = tp.callee_id
21
+ next if ! method_id_set[method_id]
22
+ next if tp.event == :c_return and
23
+ not (@parser.lineno == tp.lineno and @parser.path == tp.path)
24
+ locs = PowerAssert.app_caller_locations
25
+ diff = locs.length - base_caller_length
26
+ if (tp.event == :c_return && diff == 1 || tp.event == :return && diff <= 2) and Thread.current == @target_thread
27
+ idx = -(base_caller_length + 1)
28
+ if @parser.path == locs[idx].path and @parser.lineno == locs[idx].lineno
29
+ val = PowerAssert.configuration.lazy_inspection ?
30
+ tp.return_value :
31
+ InspectedValue.new(SafeInspectable.new(tp.return_value).inspect)
32
+ @return_values << Value[method_id.to_s, val, locs[idx].lineno, nil]
38
33
  end
39
- rescue Exception => e
40
- warn "power_assert: [BUG] Failed to trace: #{e.class}: #{e.message}"
34
+ end
35
+ rescue Exception => e
36
+ warn "power_assert: [BUG] Failed to trace: #{e.class}: #{e.message}"
37
+ if e.respond_to?(:full_message)
38
+ warn e.full_message.gsub(/^/, 'power_assert: ')
41
39
  end
42
40
  end
43
41
  end
@@ -58,8 +56,8 @@ module PowerAssert
58
56
  end
59
57
 
60
58
  def build_assertion_message(parser, return_values)
61
- if PowerAssert.configuration._colorize_message
62
- line = Pry::Code.new(parser.line).highlighted
59
+ if PowerAssert.configuration.colorize_message
60
+ line = IRB::Color.colorize_code(parser.line, ignore_error: true)
63
61
  else
64
62
  line = parser.line
65
63
  end
@@ -90,12 +88,12 @@ module PowerAssert
90
88
  end.join
91
89
  lines = []
92
90
  lines << line.chomp
93
- lines << sprintf(fmt, vals.each_with_object({}) {|v, h| h[v.display_offset.to_s.to_sym] = '|' }).chomp
91
+ lines << sprintf(fmt, vals.each_with_object({}) {|v, h| h[:"#{v.display_offset}"] = '|' }).chomp
94
92
  vals.each do |i|
95
- inspected_val = SafeInspectable.new(Formatter.new(i.value, i.display_offset)).inspect
93
+ inspected_val = SafeInspectable.new(Inspector.new(i.value, i.display_offset)).inspect
96
94
  inspected_val.each_line do |l|
97
95
  map_to = vals.each_with_object({}) do |j, h|
98
- h[j.display_offset.to_s.to_sym] = [l, '|', ' '][i.display_offset <=> j.display_offset]
96
+ h[:"#{j.display_offset}"] = [l, '|', ' '][i.display_offset <=> j.display_offset]
99
97
  end
100
98
  lines << encoding_safe_rstrip(sprintf(fmt, map_to))
101
99
  end
@@ -2,85 +2,52 @@ require 'power_assert/configuration'
2
2
 
3
3
  if defined?(RubyVM)
4
4
  if PowerAssert.configuration._redefinition
5
- if RUBY_VERSION == '2.3.2'
6
- warn 'power_assert: It is strongly recommended that you use Ruby 2.3.3 or later which fixes regression on 2.3.2.'
7
- warn 'power_assert: See https://www.ruby-lang.org/en/news/2016/11/21/ruby-2-3-3-released/ for more details.'
8
- end
9
-
10
- verbose = $VERBOSE
11
- begin
12
- $VERBOSE = nil
13
- module PowerAssert
14
- # set redefined flag
15
- basic_classes = [
16
- Fixnum, Float, String, Array, Hash, Bignum, Symbol, Time, Regexp, NilClass, TrueClass, FalseClass
17
- ]
18
-
19
- basic_operators = [
20
- :+, :-, :*, :/, :%, :==, :===, :<, :<=, :<<, :[], :[]=,
21
- :length, :size, :empty?, :succ, :>, :>=, :!, :!=, :=~, :freeze, :-@, :max, :min
22
- ]
23
-
24
- bug11182 = Class.new do
25
- def fixed?
26
- true
27
- end
28
- end
29
-
30
- refine bug11182 do
31
- def fixed?
5
+ module PowerAssert
6
+ # set redefined flag
7
+ basic_classes = [
8
+ Integer, Float, String, Array, Hash, Symbol, Time, Regexp, NilClass, TrueClass, FalseClass
9
+ ]
10
+
11
+ verbose = $VERBOSE
12
+ begin
13
+ $VERBOSE = nil
14
+ [:Fixnum, :Bignum].each do |c|
15
+ if Object.const_defined?(c) and (c = Object.const_get(c)) != Integer
16
+ basic_classes << c
32
17
  end
33
18
  end
19
+ ensure
20
+ $VERBOSE = verbose
21
+ end
34
22
 
35
- _ = Class.new(bug11182) do
36
- alias _fixed? fixed?
37
- protected :_fixed?
38
- end
39
-
40
- if (bug11182.new.fixed? rescue false)
41
- basic_classes.each do |klass|
42
- basic_operators.each do |bop|
43
- if klass.public_method_defined?(bop)
44
- refine(klass) do
45
- define_method(bop) {}
46
- end
47
- end
48
- end
49
- end
50
- else
51
- # workaround for https://bugs.ruby-lang.org/issues/11182
52
- basic_classes.each do |klass|
53
- basic_operators.each do |bop|
54
- if klass.public_method_defined?(bop)
55
- klass.ancestors.find {|i| i.instance_methods(false).index(bop) }.module_eval do
56
- public bop
57
- end
58
- end
59
- end
60
- end
23
+ basic_operators = [
24
+ :+, :-, :*, :/, :%, :==, :===, :<, :<=, :<<, :[], :[]=,
25
+ :length, :size, :empty?, :succ, :>, :>=, :!, :!=, :=~, :freeze, :-@, :max, :min, :nil?
26
+ ]
61
27
 
62
- refine Symbol do
63
- def ==
28
+ basic_classes.each do |klass|
29
+ basic_operators.each do |bop|
30
+ if klass.public_method_defined?(bop)
31
+ refine(klass) do
32
+ define_method(bop) {}
64
33
  end
65
34
  end
66
35
  end
36
+ end
67
37
 
68
- # bypass check_cfunc
69
- refine BasicObject do
70
- def !
71
- end
38
+ # bypass check_cfunc
39
+ refine BasicObject do
40
+ def !
41
+ end
72
42
 
73
- def ==
74
- end
43
+ def ==
75
44
  end
45
+ end
76
46
 
77
- refine Module do
78
- def ==
79
- end
47
+ refine Module do
48
+ def ==
80
49
  end
81
50
  end
82
- ensure
83
- $VERBOSE = verbose
84
51
  end
85
52
  end
86
53
 
@@ -1,4 +1,5 @@
1
1
  require 'power_assert/configuration'
2
+ require 'io/console/size'
2
3
 
3
4
  module PowerAssert
4
5
  class InspectedValue
@@ -34,22 +35,22 @@ module PowerAssert
34
35
  end
35
36
  private_constant :SafeInspectable
36
37
 
37
- class Formatter
38
+ class Inspector
38
39
  def initialize(value, indent)
39
40
  @value = value
40
41
  @indent = indent
41
42
  end
42
43
 
43
44
  def inspect
44
- if PowerAssert.configuration._colorize_message
45
- if PowerAssert.configuration._use_pp
46
- width = [Pry::Terminal.width! - 1 - @indent, 10].max
47
- Pry::ColorPrinter.pp(@value, '', width)
45
+ if PowerAssert.configuration.colorize_message
46
+ if PowerAssert.configuration.inspector == :pp
47
+ width = [IO.console_size[1] - 1 - @indent, 10].max
48
+ IRB::ColorPrinter.pp(@value, '', width)
48
49
  else
49
- Pry::Code.new(@value.inspect).highlighted
50
+ IRB::Color.colorize_code(@value.to_s, ignore_error: true)
50
51
  end
51
52
  else
52
- if PowerAssert.configuration._use_pp
53
+ if PowerAssert.configuration.inspector == :pp
53
54
  PP.pp(@value, '')
54
55
  else
55
56
  @value.inspect
@@ -57,5 +58,5 @@ module PowerAssert
57
58
  end
58
59
  end
59
60
  end
60
- private_constant :Formatter
61
+ private_constant :Inspector
61
62
  end
@@ -1,3 +1,3 @@
1
1
  module PowerAssert
2
- VERSION = "1.1.4"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -8,9 +8,9 @@ Gem::Specification.new do |s|
8
8
  s.version = PowerAssert::VERSION
9
9
  s.authors = ['Kazuki Tsujimoto']
10
10
  s.email = ['kazuki@callcc.net']
11
- s.homepage = 'https://github.com/k-tsj/power_assert'
11
+ s.homepage = 'https://github.com/ruby/power_assert'
12
12
  s.summary = "Power Assert for Ruby"
13
- s.description = "Power Assert for Ruby. Power Assert shows each value of variables and method calls in the expression. It is useful for testing, providing which value wasn't correct when the condition is not satisfied."
13
+ s.description = "Power Assert shows each value of variables and method calls in the expression. It is useful for testing, providing which value wasn't correct when the condition is not satisfied."
14
14
 
15
15
  s.files = `git ls-files -z`.split("\x0").reject do |f|
16
16
  f.match(%r{^(test|spec|features|benchmark)/})
@@ -22,10 +22,10 @@ Gem::Specification.new do |s|
22
22
  s.add_development_dependency 'rake'
23
23
  s.add_development_dependency 'simplecov'
24
24
  s.add_development_dependency 'bundler'
25
- s.add_development_dependency 'pry'
25
+ s.add_development_dependency 'irb', '>= 1.3.1'
26
26
  s.add_development_dependency 'byebug'
27
27
  s.add_development_dependency 'benchmark-ips'
28
- s.extra_rdoc_files = ['README.rdoc']
29
- s.rdoc_options = ['--main', 'README.rdoc']
30
- s.licenses = ['2-clause BSDL', "Ruby's"]
28
+ s.extra_rdoc_files = ['README.md']
29
+ s.rdoc_options = ['--main', 'README.md']
30
+ s.licenses = ['BSD-2-Clause', "Ruby"]
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: power_assert
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuki Tsujimoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-24 00:00:00.000000000 Z
11
+ date: 2021-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit
@@ -67,19 +67,19 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: pry
70
+ name: irb
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 1.3.1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 1.3.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: byebug
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -108,23 +108,23 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- description: Power Assert for Ruby. Power Assert shows each value of variables and
112
- method calls in the expression. It is useful for testing, providing which value
113
- wasn't correct when the condition is not satisfied.
111
+ description: Power Assert shows each value of variables and method calls in the expression.
112
+ It is useful for testing, providing which value wasn't correct when the condition
113
+ is not satisfied.
114
114
  email:
115
115
  - kazuki@callcc.net
116
116
  executables: []
117
117
  extensions: []
118
118
  extra_rdoc_files:
119
- - README.rdoc
119
+ - README.md
120
120
  files:
121
+ - ".github/workflows/ci.yml"
121
122
  - ".gitignore"
122
- - ".travis.yml"
123
123
  - BSDL
124
124
  - COPYING
125
125
  - Gemfile
126
126
  - LEGAL
127
- - README.rdoc
127
+ - README.md
128
128
  - Rakefile
129
129
  - bin/console
130
130
  - bin/setup
@@ -137,15 +137,15 @@ files:
137
137
  - lib/power_assert/parser.rb
138
138
  - lib/power_assert/version.rb
139
139
  - power_assert.gemspec
140
- homepage: https://github.com/k-tsj/power_assert
140
+ homepage: https://github.com/ruby/power_assert
141
141
  licenses:
142
- - 2-clause BSDL
143
- - Ruby's
142
+ - BSD-2-Clause
143
+ - Ruby
144
144
  metadata: {}
145
145
  post_install_message:
146
146
  rdoc_options:
147
147
  - "--main"
148
- - README.rdoc
148
+ - README.md
149
149
  require_paths:
150
150
  - lib
151
151
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
161
  requirements: []
162
- rubygems_version: 3.0.1
162
+ rubygems_version: 3.2.3
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: Power Assert for Ruby
@@ -1,24 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.0.0-p648
5
- - 2.1.10
6
- - 2.2.10
7
- - 2.3.8
8
- - 2.4.5
9
- - 2.5.3
10
- - 2.6.0
11
- - ruby-head
12
- env:
13
- - TEST_SYMLINK="no"
14
- - TEST_SYMLINK="yes"
15
- matrix:
16
- allow_failures:
17
- - rvm: ruby-head
18
- before_install:
19
- - gem install rubygems-update -v '<3' && update_rubygems
20
- - gem update bundler
21
- before_script:
22
- - bundle exec rake before_script
23
- after_script:
24
- - bundle exec rake after_script
@@ -1,81 +0,0 @@
1
- = power_assert
2
- == About
3
- Power Assert for Ruby.
4
-
5
- Power Assert shows each value of variables and method calls in the expression.
6
- It is useful for testing, providing which value wasn't correct when the condition is not satisfied.
7
-
8
- Failure:
9
- assert { 3.times.to_a.include?(3) }
10
- | | |
11
- | | false
12
- | [0, 1, 2]
13
- #<Enumerator: 3:times>
14
-
15
- == Related Projects
16
- In general, you don't need to use this library directly.
17
- Use following test frameworks or extensions instead.
18
-
19
- * {test-unit}[https://github.com/test-unit/test-unit](>= 3.0.0)
20
- * {Document}[http://test-unit.github.io/test-unit/en/Test/Unit/Assertions.html#assert-instance_method]
21
- * {minitest-power_assert}[https://github.com/hsbt/minitest-power_assert]
22
- * {rspec-power_assert}[https://github.com/joker1007/rspec-power_assert]
23
- * {pry-power_assert}[https://github.com/yui-knk/pry-power_assert]
24
- * {pry-byebug-power_assert}[https://github.com/k-tsj/pry-byebug-power_assert]
25
- * {power_p}[https://github.com/k-tsj/power_p]
26
-
27
- == Requirement
28
- * CRuby 2.0.0 or later
29
-
30
- == Reference
31
- * {Power Assert in Ruby (at RubyKaigi 2014) // Speaker Deck}[https://speakerdeck.com/k_tsj/power-assert-in-ruby]
32
-
33
- == Known Limitations
34
- * Expressions must be put in one line. Expressions with folded long lines produce nothing report, e.g.:
35
- assert do
36
- # reported
37
- func(foo: 0123456789, bar: "abcdefg")
38
- end
39
-
40
- assert do
41
- # won't be reported
42
- func(foo: 0123456789,
43
- bar: "abcdefg")
44
- end
45
- * Expressions must have one or more method call. Expressions with no method call produce nothing report, e.g.:
46
- val = false
47
- assert do
48
- # reported
49
- val == true
50
- end
51
-
52
- assert do
53
- # won't be reported
54
- val
55
- end
56
- * Returned values from accessor methods, method missing, or "super" produce nothing report, e.g:
57
- class Foo
58
- attr_accessor :val
59
- end
60
- foo = Foo.new
61
- foo.val = false
62
-
63
- assert do
64
- # reported (only the value of "foo" and the literal "true")
65
- foo.val == true
66
- end
67
-
68
- assert do
69
- # won't be reported
70
- foo.val
71
- end
72
- * Expressions should not have conditional branches. Expressions with such conditional codes may produce nothing report, e.g.:
73
- condition = true
74
- expected = false
75
- actual = true
76
- assert do
77
- # this will fail but nothing reported
78
- condition ? expected == actual : expected == actual
79
- end
80
-
81
- == Travis Build Status {<img src="https://secure.travis-ci.org/k-tsj/power_assert.png?branch=master"/>}[http://travis-ci.org/k-tsj/power_assert]