seeing_is_believing 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -11,6 +11,7 @@ Also comes with a binary to show how it might be used.
11
11
 
12
12
  For whatever reason, I can't embed videos, but **here's a ~1 minute [video][video]** showing it off.
13
13
 
14
+ Works in Ruby 1.9 and 2.0
14
15
 
15
16
  Use The Binary
16
17
  ==============
@@ -130,6 +131,7 @@ Known Issues
130
131
  * `BEGIN/END` breaks things and I probably won't take the time to fix it, becuase it's nontrivial and its really meant for command-line scripts, but there is currently a cuke for it
131
132
  * Heredocs aren't recorded. It might actually be possible if the ExpressionList were to get smarter
132
133
  * Return statements are dealt with poorly, causing some situations where you could capture and display a value to not capture
134
+ * errors come out really shitty if you're calling them from another program like TextMate, would be better to put a line in that shows where the error is.
133
135
 
134
136
  License
135
137
  =======
@@ -30,8 +30,9 @@ Feature: Running the binary successfully
30
30
 
31
31
  # multilinezzz
32
32
  "a
33
- b
34
- c"
33
+ b"
34
+ /a
35
+ b/x
35
36
 
36
37
  # don't record heredocs b/c they're just too fucking different
37
38
  <<HERE
@@ -82,8 +83,9 @@ Feature: Running the binary successfully
82
83
 
83
84
  # multilinezzz
84
85
  "a
85
- b
86
- c" # => "a\n b\n c"
86
+ b" # => "a\n b"
87
+ /a
88
+ b/x # => /a\n b/x
87
89
 
88
90
  # don't record heredocs b/c they're just too fucking different
89
91
  <<HERE
@@ -6,7 +6,7 @@ class SeeingIsBelieving
6
6
  def initialize(line, separator, result, options)
7
7
  self.line = line
8
8
  self.separator = separator
9
- self.result = result
9
+ self.result = result.gsub "\n", '\n'
10
10
  self.options = options
11
11
  end
12
12
 
@@ -15,14 +15,16 @@ class SeeingIsBelieving
15
15
  # e.g. SyntaxAnalyzer.new('"a').parse
16
16
  def ends_match?(beginning, ending)
17
17
  return false unless beginning && ending
18
- return beginning == ending if beginning.size == 1
18
+ return beginning == ending if beginning.size == 1 && ending.size == 1
19
19
  case beginning[-1]
20
20
  when '<' then '>' == ending
21
21
  when '(' then ')' == ending
22
22
  when '[' then ']' == ending
23
23
  when '{' then '}' == ending
24
+ when '/' then ending =~ /\A\// # example: /a/x
24
25
  else
25
- beginning[-1] == ending
26
+ # example: %Q.a. %_a_ %r|a| ...
27
+ beginning.start_with?('%') && beginning.end_with?(ending)
26
28
  end
27
29
  end
28
30
 
@@ -135,7 +137,7 @@ class SeeingIsBelieving
135
137
  # this is conspicuosuly inferior, but I can't figure out how to actually parse it
136
138
  # see: http://www.ruby-forum.com/topic/4409633
137
139
  def self.will_return?(code)
138
- /(^|\s)return.*?\n?\z$/ =~ code
140
+ /(^|\s)return.*?\n?\z/ =~ code
139
141
  end
140
142
 
141
143
  # HERE DOCS
@@ -1,3 +1,3 @@
1
1
  class SeeingIsBelieving
2
- VERSION = '0.0.14'
2
+ VERSION = '0.0.15'
3
3
  end
@@ -52,20 +52,20 @@ describe SeeingIsBelieving::SyntaxAnalyzer do
52
52
  end
53
53
 
54
54
  it 'knows if it contains an unclosed comment' do
55
- unclosed_comment = lambda { |code| described_class.unclosed_comment? code }
56
- unclosed_comment["=begin"].should be_true
57
- unclosed_comment["=begin\n"].should be_true
58
- unclosed_comment["=begin\n1"].should be_true
59
- unclosed_comment["1\n=begin\n1\n"].should be_true
60
- unclosed_comment["1\n=begin\n1\n =end"].should be_true
61
- unclosed_comment["1\n=begin\n1\n=end"].should be_false
62
- unclosed_comment[" =begin"].should be_false
55
+ is_unclosed_comment = lambda { |code| described_class.unclosed_comment? code }
56
+ is_unclosed_comment["=begin"].should be_true
57
+ is_unclosed_comment["=begin\n"].should be_true
58
+ is_unclosed_comment["=begin\n1"].should be_true
59
+ is_unclosed_comment["1\n=begin\n1\n"].should be_true
60
+ is_unclosed_comment["1\n=begin\n1\n =end"].should be_true
61
+ is_unclosed_comment["1\n=begin\n1\n=end"].should be_false
62
+ is_unclosed_comment[" =begin"].should be_false
63
63
  end
64
64
 
65
65
  # probably don't really need this many tests, but I'm unfamiliar with how thorough Ripper is
66
66
  # and already found areas where it doesn't behave correctly
67
67
  it 'knows if the code contains an unclosed string' do
68
- unclosed_string = lambda { |code| described_class.unclosed_string? code }
68
+ is_unclosed_string = lambda { |code| described_class.unclosed_string? code }
69
69
  [%(a),
70
70
  %("a"),
71
71
  %("a \n"),
@@ -89,7 +89,7 @@ describe SeeingIsBelieving::SyntaxAnalyzer do
89
89
  %(%<>),
90
90
  %(%..),
91
91
  ].each do |string|
92
- unclosed_string[string].should be_false, "Expected #{string.inspect} to be closed"
92
+ is_unclosed_string[string].should be_false, "Expected #{string.inspect} to be closed"
93
93
  end
94
94
 
95
95
  [%(a "),
@@ -113,12 +113,12 @@ describe SeeingIsBelieving::SyntaxAnalyzer do
113
113
  %("\#{"}"),
114
114
  %("\#{%(\#{%[\#{%[}]})}"),
115
115
  ].each do |string|
116
- unclosed_string[string].should be_true, "Expected #{string.inspect} to be unclosed"
116
+ is_unclosed_string[string].should be_true, "Expected #{string.inspect} to be unclosed"
117
117
  end
118
118
  end
119
119
 
120
120
  it 'knows if the code contains an unclosed regexp' do
121
- unclosed_regexp = lambda { |code| described_class.unclosed_regexp? code }
121
+ is_unclosed_regexp = lambda { |code| described_class.unclosed_regexp? code }
122
122
  [%(a),
123
123
  %(/a/),
124
124
  %(/a \n/),
@@ -130,8 +130,11 @@ describe SeeingIsBelieving::SyntaxAnalyzer do
130
130
  %(%r{}),
131
131
  %(%r<>),
132
132
  %(%r..),
133
+ %(/\na\nb\n/x),
134
+ %(r..i),
135
+ %(/\na\nb\n/xmi),
133
136
  ].each do |code|
134
- unclosed_regexp[code].should be_false, "Expected #{code.inspect} to be closed"
137
+ is_unclosed_regexp[code].should be_false, "Expected #{code.inspect} to be closed"
135
138
  end
136
139
 
137
140
  [%(a + /),
@@ -147,7 +150,7 @@ describe SeeingIsBelieving::SyntaxAnalyzer do
147
150
  %(%r[\#{),
148
151
  %("\#{%r[}"),
149
152
  ].each do |code|
150
- unclosed_regexp[code].should be_true, "Expected #{code.inspect} to be unclosed"
153
+ is_unclosed_regexp[code].should be_true, "Expected #{code.inspect} to be unclosed"
151
154
  end
152
155
  end
153
156
 
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seeing_is_believing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ prerelease:
5
+ version: 0.0.15
5
6
  platform: ruby
6
7
  authors:
7
8
  - Josh Cheek
@@ -11,61 +12,69 @@ cert_chain: []
11
12
  date: 2013-03-02 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
- name: rake
15
- requirement: !ruby/object:Gem::Requirement
15
+ version_requirements: !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
20
22
  type: :development
21
23
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
24
+ requirement: !ruby/object:Gem::Requirement
23
25
  requirements:
24
26
  - - ~>
25
27
  - !ruby/object:Gem::Version
26
28
  version: 10.0.3
29
+ none: false
27
30
  - !ruby/object:Gem::Dependency
28
- name: rspec
29
- requirement: !ruby/object:Gem::Requirement
31
+ version_requirements: !ruby/object:Gem::Requirement
30
32
  requirements:
31
33
  - - ~>
32
34
  - !ruby/object:Gem::Version
33
35
  version: 2.12.0
36
+ none: false
37
+ name: rspec
34
38
  type: :development
35
39
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
40
+ requirement: !ruby/object:Gem::Requirement
37
41
  requirements:
38
42
  - - ~>
39
43
  - !ruby/object:Gem::Version
40
44
  version: 2.12.0
45
+ none: false
41
46
  - !ruby/object:Gem::Dependency
42
- name: cucumber
43
- requirement: !ruby/object:Gem::Requirement
47
+ version_requirements: !ruby/object:Gem::Requirement
44
48
  requirements:
45
49
  - - ~>
46
50
  - !ruby/object:Gem::Version
47
51
  version: 1.2.1
52
+ none: false
53
+ name: cucumber
48
54
  type: :development
49
55
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
56
+ requirement: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - ~>
53
59
  - !ruby/object:Gem::Version
54
60
  version: 1.2.1
61
+ none: false
55
62
  - !ruby/object:Gem::Dependency
56
- name: ichannel
57
- requirement: !ruby/object:Gem::Requirement
63
+ version_requirements: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - ~>
60
66
  - !ruby/object:Gem::Version
61
67
  version: 5.1.1
68
+ none: false
69
+ name: ichannel
62
70
  type: :development
63
71
  prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
72
+ requirement: !ruby/object:Gem::Requirement
65
73
  requirements:
66
74
  - - ~>
67
75
  - !ruby/object:Gem::Version
68
76
  version: 5.1.1
77
+ none: false
69
78
  description: Records the results of every line of code in your file (intended to be
70
79
  like xmpfilter), inspired by Bret Victor's JavaScript example in his talk "Inventing
71
80
  on Principle"
@@ -119,26 +128,27 @@ files:
119
128
  homepage: https://github.com/JoshCheek/seeing_is_believing
120
129
  licenses:
121
130
  - WTFPL
122
- metadata: {}
123
131
  post_install_message:
124
132
  rdoc_options: []
125
133
  require_paths:
126
134
  - lib
127
135
  required_ruby_version: !ruby/object:Gem::Requirement
128
136
  requirements:
129
- - - '>='
137
+ - - ! '>='
130
138
  - !ruby/object:Gem::Version
131
139
  version: '0'
140
+ none: false
132
141
  required_rubygems_version: !ruby/object:Gem::Requirement
133
142
  requirements:
134
- - - '>='
143
+ - - ! '>='
135
144
  - !ruby/object:Gem::Version
136
145
  version: '0'
146
+ none: false
137
147
  requirements: []
138
148
  rubyforge_project: seeing_is_believing
139
- rubygems_version: 2.0.0
149
+ rubygems_version: 1.8.23
140
150
  signing_key:
141
- specification_version: 4
151
+ specification_version: 3
142
152
  summary: Records results of every line of code in your file
143
153
  test_files:
144
154
  - features/errors.feature
@@ -155,3 +165,4 @@ test_files:
155
165
  - spec/queue_spec.rb
156
166
  - spec/seeing_is_believing_spec.rb
157
167
  - spec/syntax_analyzer_spec.rb
168
+ has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: c99b16d96b21e8940fcb38b3aabecfd237c59d09
4
- data.tar.gz: 3b871ae98e98cc26ac8cb123a09b31fe8cc3bcea
5
- SHA512:
6
- metadata.gz: c68fece19b501e2ce1decdc23a128a010e500a1ddcd1fdf2eedd3047ae8c6807e51c7fc61f04ec40bbdbb0687e12c4d29338a31f5d779255213b1361245fd6e2
7
- data.tar.gz: bc28374e2d99a03abf05c17e63de56c3388f78afe699644736744d1173f475088c883fa2f2e5f828b683e0e2733716121d841dfc777e3c1b7a8bc4167517e714