seeing_is_believing 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Readme.md +2 -2
- data/features/regression.feature +18 -0
- data/features/step_definitions/steps.rb +1 -6
- data/lib/seeing_is_believing/binary/{align_all.rb → align_file.rb} +1 -1
- data/lib/seeing_is_believing/binary/arg_parser.rb +3 -3
- data/lib/seeing_is_believing/binary/line_formatter.rb +1 -1
- data/lib/seeing_is_believing/binary/print_results_next_to_lines.rb +1 -1
- data/lib/seeing_is_believing/evaluate_by_moving_files.rb +1 -4
- data/lib/seeing_is_believing/has_exception.rb +0 -22
- data/lib/seeing_is_believing/the_matrix.rb +1 -2
- data/lib/seeing_is_believing/version.rb +1 -1
- data/spec/arg_parser_spec.rb +4 -4
- data/spec/line_formatter_spec.rb +10 -10
- metadata +22 -31
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a0239955a4f0eed7bb1d8375eb19f46f71a1e3b4
|
4
|
+
data.tar.gz: 87fb7ea1bd915f6ba4b220e1b715cf0cc7dd20cd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6895a441e1928973460c5870594448802e4b07b17fa6c2276eb22f79b5855d5b77f7255e7adeec99945203d0305bb38d14fdec4195f0ad04a74e7e49c56f3235
|
7
|
+
data.tar.gz: 47ae5ef6f159e909f18709c38cb9cf4336557664b8a62b066b633a3c3985e33644c04cca530eafeb16456d139b0461635e7ee909ec07a7da5c2c0bf6505a2c99
|
data/Readme.md
CHANGED
@@ -90,9 +90,9 @@ Go to the bundle editor, create this new command in the Ruby bundle:
|
|
90
90
|
|
91
91
|
```shell
|
92
92
|
if [ -z "$TM_FILEPATH" ]; then
|
93
|
-
"${TM_RUBY}" -S seeing_is_believing -Ku --result-length 200
|
93
|
+
"${TM_RUBY}" -S seeing_is_believing -Ku --result-length 200 --alignment-strategy chunk --timeout 12
|
94
94
|
else
|
95
|
-
"${TM_RUBY}" -S seeing_is_believing -Ku --result-length 200 --as "$TM_FILEPATH"
|
95
|
+
"${TM_RUBY}" -S seeing_is_believing -Ku --result-length 200 --as "$TM_FILEPATH" --alignment-strategy chunk --timeout 12
|
96
96
|
fi
|
97
97
|
```
|
98
98
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Feature:
|
2
|
+
In order to not fix the same shit over and over again
|
3
|
+
As the dev who wrote SeeingIsBelieving
|
4
|
+
I want to have tests on those bugs that I found and could not have predicted
|
5
|
+
|
6
|
+
@wip
|
7
|
+
Scenario: No method error just fucks everything
|
8
|
+
Given the file "no_method_error.rb":
|
9
|
+
"""
|
10
|
+
a
|
11
|
+
"""
|
12
|
+
When I run "seeing_is_believing no_method_error.rb"
|
13
|
+
Then stderr is empty
|
14
|
+
And the exit status is 1
|
15
|
+
And stdout is:
|
16
|
+
"""
|
17
|
+
a # ~> NameError: undefined local variable or method `a' for main:Object
|
18
|
+
"""
|
@@ -6,11 +6,6 @@ When('I run "$command"') { |command| @last_exec
|
|
6
6
|
When("I run '$command'") { |command| @last_executed = CommandLineHelpers.execute command, @stdin_data }
|
7
7
|
Then(/^(stderr|stdout) is:$/) { |stream_name, output| @last_executed.send(stream_name).chomp.should == eval_curlies(output) }
|
8
8
|
Then(/^(stderr|stdout) is ["'](.*?)["']$/) { |stream_name, output| @last_executed.send(stream_name).chomp.should == eval_curlies(output) }
|
9
|
-
Then(/^(stderr|stdout) is empty$/) { |stream_name|
|
10
|
-
stream = @last_executed.send(stream_name)
|
11
|
-
if stream != ''
|
12
|
-
raise "EXPECTED NOTHING, GOT #{stream}"
|
13
|
-
end
|
14
|
-
}
|
9
|
+
Then(/^(stderr|stdout) is empty$/) { |stream_name| @last_executed.send(stream_name).should == '' }
|
15
10
|
Then(/^(stderr|stdout) includes "([^"]*)"$/) { |stream_name, content| @last_executed.send(stream_name).should include eval_curlies(content) }
|
16
11
|
Then('the exit status is $status') { |status| @last_executed.exitstatus.to_s.should == status }
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'seeing_is_believing/version'
|
2
|
-
require 'seeing_is_believing/binary/
|
2
|
+
require 'seeing_is_believing/binary/align_file'
|
3
3
|
require 'seeing_is_believing/binary/align_line'
|
4
4
|
require 'seeing_is_believing/binary/align_chunk'
|
5
5
|
|
@@ -77,14 +77,14 @@ class SeeingIsBelieving
|
|
77
77
|
errors: [],
|
78
78
|
require: [],
|
79
79
|
load_path: [],
|
80
|
-
alignment_strategy:
|
80
|
+
alignment_strategy: AlignFile,
|
81
81
|
}
|
82
82
|
end
|
83
83
|
|
84
84
|
|
85
85
|
def extract_alignment_strategy
|
86
86
|
strategies = {
|
87
|
-
'file' =>
|
87
|
+
'file' => AlignFile,
|
88
88
|
'chunk' => AlignChunk,
|
89
89
|
'line' => AlignLine,
|
90
90
|
}
|
@@ -99,7 +99,7 @@ class SeeingIsBelieving
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def format_line(line, line_number, line_results)
|
102
|
-
options = options().merge
|
102
|
+
options = options().merge pad_to: alignment_strategy.line_length_for(line_number)
|
103
103
|
formatted_line = if line_results.has_exception?
|
104
104
|
result = sprintf "%s: %s", line_results.exception.class, line_results.exception.message
|
105
105
|
LineFormatter.new(line, "#{EXCEPTION_PREFIX} ", result, options).call
|
@@ -11,7 +11,6 @@
|
|
11
11
|
# I did look at Ripper, and it will invoke on_kw("__FILE__")
|
12
12
|
# when it sees this.
|
13
13
|
|
14
|
-
require 'yaml'
|
15
14
|
require 'open3'
|
16
15
|
require 'stringio'
|
17
16
|
require 'fileutils'
|
@@ -130,9 +129,7 @@ class SeeingIsBelieving
|
|
130
129
|
end
|
131
130
|
|
132
131
|
def deserialize_result
|
133
|
-
|
134
|
-
result.fix_exception_backtraces_after_yaml_serialization
|
135
|
-
result
|
132
|
+
Marshal.load stdout
|
136
133
|
end
|
137
134
|
|
138
135
|
def notify_user_of_error
|
@@ -2,27 +2,5 @@ class SeeingIsBelieving
|
|
2
2
|
module HasException
|
3
3
|
attr_accessor :exception
|
4
4
|
alias has_exception? exception
|
5
|
-
|
6
|
-
# NOTE:
|
7
|
-
# zomg, so YAML doesn't serialize an exception's backtrace
|
8
|
-
# and Marshal gets all horked on windows (something like Marshal data too short)
|
9
|
-
# so I'm going back to YAML, but independently storing the backtrace
|
10
|
-
# It will need to get manually set back onto the exception
|
11
|
-
#
|
12
|
-
# However, there is no Exception#backtrace=, so I have to redefine the method
|
13
|
-
# which sucks b/c of cache busting and so forth
|
14
|
-
# but that probably doesn't actually matter for any real-world use case of SeeingIsBelieving
|
15
|
-
|
16
|
-
def exception=(exception)
|
17
|
-
@exception = exception
|
18
|
-
@exception_backtrace = exception.backtrace
|
19
|
-
end
|
20
|
-
|
21
|
-
def fix_exception_backtraces_after_yaml_serialization
|
22
|
-
return unless exception
|
23
|
-
exception_backtrace = @exception_backtrace
|
24
|
-
exception.define_singleton_method(:backtrace) { exception_backtrace }
|
25
|
-
self
|
26
|
-
end
|
27
5
|
end
|
28
6
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# WARNING: DO NOT REQUIRE THIS FILE, IT WILL FUCK YOU UP!!!!!!
|
2
2
|
|
3
3
|
|
4
|
-
require 'yaml'
|
5
4
|
require 'stringio'
|
6
5
|
real_stdout = STDOUT
|
7
6
|
real_stderr = STDERR
|
@@ -15,5 +14,5 @@ at_exit do
|
|
15
14
|
$seeing_is_believing_current_result.stdout = fake_stdout.string
|
16
15
|
$seeing_is_believing_current_result.stderr = fake_stderr.string
|
17
16
|
|
18
|
-
real_stdout.write
|
17
|
+
real_stdout.write Marshal.dump $seeing_is_believing_current_result
|
19
18
|
end
|
data/spec/arg_parser_spec.rb
CHANGED
@@ -285,13 +285,13 @@ describe SeeingIsBelieving::Binary::ArgParser do
|
|
285
285
|
end
|
286
286
|
|
287
287
|
describe ':alignment_strategy' do
|
288
|
-
|
288
|
+
AlignFile = SeeingIsBelieving::Binary::AlignFile
|
289
289
|
AlignLine = SeeingIsBelieving::Binary::AlignLine
|
290
290
|
AlignChunk = SeeingIsBelieving::Binary::AlignChunk
|
291
291
|
|
292
292
|
# maybe change the default?
|
293
|
-
it 'defaults to
|
294
|
-
parse([])[:alignment_strategy].should ==
|
293
|
+
it 'defaults to AlignFile' do
|
294
|
+
parse([])[:alignment_strategy].should == AlignFile
|
295
295
|
end
|
296
296
|
|
297
297
|
specify '-s and --alignment-strategy sets the alignment strategy' do
|
@@ -300,7 +300,7 @@ describe SeeingIsBelieving::Binary::ArgParser do
|
|
300
300
|
end
|
301
301
|
|
302
302
|
it 'accepts values: file, line, chunk' do
|
303
|
-
parse(['-s', 'file'])[:alignment_strategy].should ==
|
303
|
+
parse(['-s', 'file'])[:alignment_strategy].should == AlignFile
|
304
304
|
parse(['-s', 'line'])[:alignment_strategy].should == AlignLine
|
305
305
|
parse(['-s', 'chunk'])[:alignment_strategy].should == AlignChunk
|
306
306
|
end
|
data/spec/line_formatter_spec.rb
CHANGED
@@ -34,20 +34,20 @@ describe SeeingIsBelieving::Binary::LineFormatter do
|
|
34
34
|
result_for(line, separator, result, line_length: 0).should == '1'
|
35
35
|
end
|
36
36
|
|
37
|
-
specify '
|
38
|
-
result_for('1', '=>', '2',
|
39
|
-
result_for('1', '=>', '2',
|
40
|
-
result_for('1', '=>', '2',
|
37
|
+
specify 'pad_to will pad the length that the line is displayed in' do
|
38
|
+
result_for('1', '=>', '2', pad_to: 0).should == '1=>2'
|
39
|
+
result_for('1', '=>', '2', pad_to: 1).should == '1=>2'
|
40
|
+
result_for('1', '=>', '2', pad_to: 2).should == '1 =>2'
|
41
41
|
end
|
42
42
|
|
43
|
-
specify '
|
44
|
-
result_for('1', '=>', '12345',
|
45
|
-
result_for('1', '=>', '12345',
|
43
|
+
specify 'pad_to is ignored when separator/result will not be printed' do
|
44
|
+
result_for('1', '=>', '12345', pad_to: 2, line_length: 2).should == '1'
|
45
|
+
result_for('1', '=>', '12345', pad_to: 2, result_length: 2).should == '1'
|
46
46
|
end
|
47
47
|
|
48
48
|
specify 'they can all work together' do
|
49
|
-
result_for('1', '=>', '12345', line_length: 100, result_length: 100,
|
50
|
-
result_for('1', '=>', '12345', line_length: 8, result_length: 100,
|
51
|
-
result_for('1', '=>', '12345', line_length: 100, result_length: 6,
|
49
|
+
result_for('1', '=>', '12345', line_length: 100, result_length: 100, pad_to: 2).should == '1 =>12345'
|
50
|
+
result_for('1', '=>', '12345', line_length: 8, result_length: 100, pad_to: 2).should == '1 =>1...'
|
51
|
+
result_for('1', '=>', '12345', line_length: 100, result_length: 6, pad_to: 2).should == '1 =>1...'
|
52
52
|
end
|
53
53
|
end
|
metadata
CHANGED
@@ -1,80 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seeing_is_believing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.0.17
|
4
|
+
version: 0.0.18
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Josh Cheek
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 10.0.3
|
20
|
-
none: false
|
21
|
-
name: rake
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
23
|
requirements:
|
26
24
|
- - ~>
|
27
25
|
- !ruby/object:Gem::Version
|
28
26
|
version: 10.0.3
|
29
|
-
none: false
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
32
30
|
requirements:
|
33
31
|
- - ~>
|
34
32
|
- !ruby/object:Gem::Version
|
35
33
|
version: 2.12.0
|
36
|
-
none: false
|
37
|
-
name: rspec
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
37
|
requirements:
|
42
38
|
- - ~>
|
43
39
|
- !ruby/object:Gem::Version
|
44
40
|
version: 2.12.0
|
45
|
-
none: false
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
|
42
|
+
name: cucumber
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
48
44
|
requirements:
|
49
45
|
- - ~>
|
50
46
|
- !ruby/object:Gem::Version
|
51
47
|
version: 1.2.1
|
52
|
-
none: false
|
53
|
-
name: cucumber
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
52
|
- - ~>
|
59
53
|
- !ruby/object:Gem::Version
|
60
54
|
version: 1.2.1
|
61
|
-
none: false
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
|
-
|
56
|
+
name: ichannel
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
64
58
|
requirements:
|
65
59
|
- - ~>
|
66
60
|
- !ruby/object:Gem::Version
|
67
61
|
version: 5.1.1
|
68
|
-
none: false
|
69
|
-
name: ichannel
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
|
-
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
65
|
requirements:
|
74
66
|
- - ~>
|
75
67
|
- !ruby/object:Gem::Version
|
76
68
|
version: 5.1.1
|
77
|
-
none: false
|
78
69
|
description: Records the results of every line of code in your file (intended to be
|
79
70
|
like xmpfilter), inspired by Bret Victor's JavaScript example in his talk "Inventing
|
80
71
|
on Principle"
|
@@ -95,12 +86,13 @@ files:
|
|
95
86
|
- features/errors.feature
|
96
87
|
- features/examples.feature
|
97
88
|
- features/flags.feature
|
89
|
+
- features/regression.feature
|
98
90
|
- features/step_definitions/steps.rb
|
99
91
|
- features/support/env.rb
|
100
92
|
- lib/seeing_is_believing.rb
|
101
93
|
- lib/seeing_is_believing/binary.rb
|
102
|
-
- lib/seeing_is_believing/binary/align_all.rb
|
103
94
|
- lib/seeing_is_believing/binary/align_chunk.rb
|
95
|
+
- lib/seeing_is_believing/binary/align_file.rb
|
104
96
|
- lib/seeing_is_believing/binary/align_line.rb
|
105
97
|
- lib/seeing_is_believing/binary/arg_parser.rb
|
106
98
|
- lib/seeing_is_believing/binary/line_formatter.rb
|
@@ -131,32 +123,32 @@ files:
|
|
131
123
|
homepage: https://github.com/JoshCheek/seeing_is_believing
|
132
124
|
licenses:
|
133
125
|
- WTFPL
|
126
|
+
metadata: {}
|
134
127
|
post_install_message:
|
135
128
|
rdoc_options: []
|
136
129
|
require_paths:
|
137
130
|
- lib
|
138
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
139
132
|
requirements:
|
140
|
-
- -
|
133
|
+
- - '>='
|
141
134
|
- !ruby/object:Gem::Version
|
142
135
|
version: '0'
|
143
|
-
none: false
|
144
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
137
|
requirements:
|
146
|
-
- -
|
138
|
+
- - '>='
|
147
139
|
- !ruby/object:Gem::Version
|
148
140
|
version: '0'
|
149
|
-
none: false
|
150
141
|
requirements: []
|
151
142
|
rubyforge_project: seeing_is_believing
|
152
|
-
rubygems_version:
|
143
|
+
rubygems_version: 2.0.0
|
153
144
|
signing_key:
|
154
|
-
specification_version:
|
145
|
+
specification_version: 4
|
155
146
|
summary: Records results of every line of code in your file
|
156
147
|
test_files:
|
157
148
|
- features/errors.feature
|
158
149
|
- features/examples.feature
|
159
150
|
- features/flags.feature
|
151
|
+
- features/regression.feature
|
160
152
|
- features/step_definitions/steps.rb
|
161
153
|
- features/support/env.rb
|
162
154
|
- spec/arg_parser_spec.rb
|
@@ -168,4 +160,3 @@ test_files:
|
|
168
160
|
- spec/queue_spec.rb
|
169
161
|
- spec/seeing_is_believing_spec.rb
|
170
162
|
- spec/syntax_analyzer_spec.rb
|
171
|
-
has_rdoc:
|