irb-power_assert 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -12
- data/lib/irb/cmd/pa.rb +1 -2
- data/lib/irb/power_assert.rb +10 -1
- data/lib/irb/power_assert/version.rb +1 -1
- metadata +64 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53539a445423eb8adef370acb59e770f5b00e94738e0916c4f297ea288682635
|
4
|
+
data.tar.gz: f873cfee93b65103ee33fc70a573cbed466c740d96826be8449af78dfc32c8fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27ee5af7ee58dc4bad98269c1519e5575bebe64e57f354176d5bc282ef93f704afcac9d089423485b38735537086d8b591de037559e6e65b616c1cdf26f6dc6e
|
7
|
+
data.tar.gz: a6564ce99454129d7df25c6c4b6c9e5704448bc5032c64d26565296626e7c29ff0c93c9cb2a93048fbba26c713da47524fac8513a4df1c646ae2801c51b91520
|
data/README.md
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
## Overview
|
7
7
|
|
8
|
-
![screenshot](https://user-images.githubusercontent.com/1180335/
|
8
|
+
![screenshot](https://user-images.githubusercontent.com/1180335/118403880-772c8000-b6ab-11eb-9469-c27aa0b67db8.png)
|
9
9
|
|
10
|
-
[ruby/power_assert](https://github.com/ruby/power_assert) is a recent My favorites.
|
10
|
+
[ruby/power_assert](https://github.com/ruby/power_assert) is a recent My favorites. (the author is [@k-tsj](https://github.com/k-tsj), thank you!)
|
11
11
|
|
12
|
-
It is super helpful in
|
12
|
+
It is super helpful in complex testing.
|
13
13
|
|
14
14
|
Don't say [ruby/irb](https://github.com/ruby/irb) is old-fashioned.
|
15
15
|
|
@@ -53,20 +53,22 @@ $ irb
|
|
53
53
|
The you can use `pa` as an IRB command.
|
54
54
|
|
55
55
|
```ruby
|
56
|
-
irb(main):001:0> pa
|
56
|
+
irb(main):001:0> pa %q{ "0".class == "3".to_i.times.map {|i| i + 1 }.class }
|
57
57
|
result: false
|
58
58
|
|
59
|
-
"0".class == "3".to_i.times.map {|i| i + 1 }.class
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
59
|
+
"0".class == "3".to_i.times.map {|i| i + 1 }.class
|
60
|
+
| | | | | |
|
61
|
+
| | | | | Array
|
62
|
+
| | | | [1, 2, 3]
|
63
|
+
| | | #<Enumerator: ...>
|
64
|
+
| | 3
|
65
|
+
| false
|
66
|
+
String
|
67
67
|
=> nil
|
68
68
|
```
|
69
69
|
|
70
70
|
## References
|
71
71
|
|
72
|
+
* [power-assert-js/power-assert](https://github.com/power-assert-js/power-assert)
|
73
|
+
* [Power Assert in Ruby](https://speakerdeck.com/k_tsj/power-assert-in-ruby)
|
72
74
|
* [ja - IRB is new than Pry](https://k0kubun.hatenablog.com/entry/2021/04/02/211455)
|
data/lib/irb/cmd/pa.rb
CHANGED
@@ -10,8 +10,7 @@ module IRB
|
|
10
10
|
class Pa < Nop
|
11
11
|
def execute(expression)
|
12
12
|
# The implementation basically taken from https://github.com/yui-knk/pry-power_assert/blob/2d10ee3df8efaf9c448f31d51bff8033a1792739/lib/pry-power_assert.rb#L26-L35, thank you!
|
13
|
-
|
14
|
-
result = +"result: "
|
13
|
+
result = +'result: '
|
15
14
|
|
16
15
|
::PowerAssert.start(expression, source_binding: irb_context.workspace.binding) do |pa|
|
17
16
|
result << pa.yield.inspect << "\n\n"
|
data/lib/irb/power_assert.rb
CHANGED
@@ -3,11 +3,20 @@
|
|
3
3
|
# Copyright (C) 2021 Kenichi Kamiya
|
4
4
|
|
5
5
|
require 'irb'
|
6
|
-
|
6
|
+
require 'power_assert'
|
7
7
|
require_relative 'cmd/pa'
|
8
8
|
|
9
9
|
module IRB
|
10
|
+
module PowerAssert
|
11
|
+
end
|
12
|
+
|
10
13
|
module ExtendCommandBundle
|
11
14
|
def_extend_command(:irb_pa, :Pa, "#{__dir__}/cmd/pa.rb", [:pa, NO_OVERRIDE])
|
12
15
|
end
|
13
16
|
end
|
17
|
+
|
18
|
+
module PowerAssert
|
19
|
+
INTERNAL_LIB_DIRS[IRB::PowerAssert] = File.dirname(File.dirname(caller_locations(1, 1).first.path))
|
20
|
+
end
|
21
|
+
|
22
|
+
require_relative 'power_assert/version'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: irb-power_assert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenichi Kamiya
|
@@ -110,8 +110,69 @@ dependencies:
|
|
110
110
|
- - "<"
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '20.0'
|
113
|
-
|
114
|
-
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rubocop
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 1.14.0
|
120
|
+
- - "<"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 1.15.0
|
123
|
+
type: :development
|
124
|
+
prerelease: false
|
125
|
+
version_requirements: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: 1.14.0
|
130
|
+
- - "<"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 1.15.0
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: rubocop-rake
|
135
|
+
requirement: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
type: :development
|
141
|
+
prerelease: false
|
142
|
+
version_requirements: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
- !ruby/object:Gem::Dependency
|
148
|
+
name: rubocop-performance
|
149
|
+
requirement: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
type: :development
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
- !ruby/object:Gem::Dependency
|
162
|
+
name: rubocop-rubycw
|
163
|
+
requirement: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
type: :development
|
169
|
+
prerelease: false
|
170
|
+
version_requirements: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
description: power_assert in irb
|
115
176
|
email:
|
116
177
|
- kachick1+ruby@gmail.com
|
117
178
|
executables: []
|