livetext 0.9.14 → 0.9.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cmdargs.rb +93 -0
  3. data/lib/formatline.rb +56 -83
  4. data/lib/helpers.rb +142 -4
  5. data/lib/livetext.rb +11 -141
  6. data/lib/parser/file.rb +8 -0
  7. data/lib/parser/mixin.rb +28 -15
  8. data/lib/parser/set.rb +35 -26
  9. data/lib/parser/string.rb +19 -4
  10. data/lib/processor.rb +1 -4
  11. data/lib/standard.rb +56 -96
  12. data/plugin/bookish.rb +26 -22
  13. data/plugin/calibre.rb +1 -1
  14. data/plugin/livemagick.rb +10 -10
  15. data/plugin/markdown.rb +13 -11
  16. data/plugin/pyggish.rb +94 -84
  17. data/plugin/tutorial.rb +10 -5
  18. data/test/all.rb +0 -1
  19. data/test/snapshots/OMIT.txt +7 -8
  20. data/test/snapshots/clusion.txt +35 -0
  21. data/test/snapshots/error_inc_line_num/actual-error.txt +14 -0
  22. data/test/snapshots/error_inc_line_num/actual-output.txt +7 -0
  23. data/test/snapshots/error_inc_line_num/match-error.txt +1 -1
  24. data/test/snapshots/error_inc_line_num/out-sdiff.txt +14 -0
  25. data/test/snapshots/error_invalid_name/actual-error.txt +10 -0
  26. data/test/snapshots/error_invalid_name/actual-output.txt +0 -0
  27. data/test/snapshots/error_invalid_name/match-error.txt +1 -1
  28. data/test/snapshots/error_invalid_name/out-sdiff.txt +6 -0
  29. data/test/snapshots/error_line_num/match-error.txt +1 -1
  30. data/test/snapshots/error_mismatched_end/match-error.txt +1 -1
  31. data/test/snapshots/error_missing_end/actual-error.txt +10 -0
  32. data/test/snapshots/error_missing_end/actual-output.txt +0 -0
  33. data/test/snapshots/error_missing_end/match-error.txt +1 -1
  34. data/test/snapshots/error_missing_end/out-sdiff.txt +6 -0
  35. data/test/snapshots/error_no_such_copy/actual-error.txt +10 -0
  36. data/test/snapshots/error_no_such_copy/actual-output.txt +0 -0
  37. data/test/snapshots/error_no_such_copy/match-error.txt +1 -1
  38. data/test/snapshots/error_no_such_copy/out-sdiff.txt +5 -0
  39. data/test/snapshots/error_no_such_copy/source.lt3 +0 -1
  40. data/test/snapshots/error_no_such_inc/actual-error.txt +10 -0
  41. data/test/snapshots/error_no_such_inc/actual-output.txt +0 -0
  42. data/test/snapshots/error_no_such_inc/match-error.txt +1 -1
  43. data/test/snapshots/error_no_such_inc/out-sdiff.txt +6 -0
  44. data/test/snapshots/error_no_such_mixin/actual-error.txt +37 -0
  45. data/test/snapshots/error_no_such_mixin/actual-output.txt +0 -0
  46. data/test/snapshots/error_no_such_mixin/out-sdiff.txt +6 -0
  47. data/test/snapshots/simple_import/actual-error.txt +8 -0
  48. data/test/snapshots/simple_import/actual-output.txt +3 -0
  49. data/test/snapshots/simple_import/err-sdiff.txt +9 -0
  50. data/test/snapshots/simple_import/expected-error.txt +0 -0
  51. data/test/snapshots/simple_import/expected-output.txt +7 -0
  52. data/test/snapshots/simple_import/out-sdiff.txt +9 -0
  53. data/test/snapshots/simple_import/simple_import.rb +5 -0
  54. data/test/snapshots/simple_import/source.lt3 +7 -0
  55. data/test/snapshots/simple_include/source.lt3 +0 -1
  56. data/test/snapshots.rb +3 -2
  57. data/test/unit/all.rb +1 -0
  58. data/test/unit/formatline.rb +650 -0
  59. data/test/unit/parser/importable.rb +1 -1
  60. data/test/unit/parser/mixin.rb +1 -1
  61. data/test/unit/parser/set.rb +19 -12
  62. data/test/unit/parser/string.rb +14 -14
  63. metadata +32 -5
  64. data/test/formatting-tests.rb +0 -35
  65. data/test/formatting.rb +0 -103
  66. data/test/snapshots/formatting-tests.txt +0 -124
data/plugin/pyggish.rb CHANGED
@@ -1,58 +1,4 @@
1
- require 'pygments'
2
-
3
- module PygmentFix # Remove CSS for Jutoh
4
- Styles = {
5
- :c => "#408080-i", # Comment
6
- :k => "#008000-b", # Keyword
7
- :o => "#666666", # Operator
8
- :cm => "#408080-i", # Comment.Multiline
9
- :cp => "#BC7A00", # Comment.Preproc
10
- :c1 => "#408080-i", # Comment.Single
11
- :cs => "#408080-i", # Comment.Special
12
- :kc => "#008000-b", # Keyword.Constant
13
- :kd => "#008000-b", # Keyword.Declaration
14
- :kn => "#008000-b", # Keyword.Namespace
15
- :kp => "#008000", # Keyword.Pseudo
16
- :kr => "#008000-b", # Keyword.Reserved
17
- :kt => "#B00040", # Keyword.Type
18
- :m => "#666666", # Literal.Number
19
- :s => "#BA2121", # Literal.String
20
- :na => "#7D9029", # Name.Attribute
21
- :nb => "#008000", # Name.Builtin
22
- :nc => "#0000FF-b", # Name.Class
23
- :no => "#880000", # Name.Constant
24
- :nd => "#AA22FF", # Name.Decorator
25
- :ni => "#999999-b", # Name.Entity
26
- :ne => "#D2413A-b", # Name.Exception
27
- :nf => "#0000FF", # Name.Function
28
- :nl => "#A0A000", # Name.Label
29
- :nn => "#0000FF-b", # Name.Namespace
30
- :nt => "#008000-b", # Name.Tag
31
- :nv => "#19177C", # Name.Variable
32
- :ow => "#AA22FF-b", # Operator.Word
33
- :w => "#bbbbbb", # Text.Whitespace
34
- :mb => "#666666", # Literal.Number.Bin
35
- :mf => "#666666", # Literal.Number.Float
36
- :mh => "#666666", # Literal.Number.Hex
37
- :mi => "#666666", # Literal.Number.Integer
38
- :mo => "#666666", # Literal.Number.Oct
39
- :sb => "#BA2121", # Literal.String.Backtick
40
- :sc => "#BA2121", # Literal.String.Char
41
- :sd => "#BA2121-i", # Literal.String.Doc
42
- :s2 => "#BA2121", # Literal.String.Double
43
- :se => "#BB6622-b", # Literal.String.Escape
44
- :sh => "#BA2121", # Literal.String.Heredoc
45
- :si => "#BB6688-b", # Literal.String.Interpol
46
- :sx => "#008000", # Literal.String.Other
47
- :sr => "#BB6688", # Literal.String.Regex
48
- :s1 => "#BA2121", # Literal.String.Single
49
- :ss => "#19177C", # Literal.String.Symbol
50
- :bp => "#008000", # Name.Builtin.Pseudo
51
- :vc => "#19177C", # Name.Variable.Class
52
- :vg => "#19177C", # Name.Variable.Global
53
- :vi => "#19177C", # Name.Variable.Instance
54
- :il => "#666666" # Literal.Number.Integer.Long
55
- }
1
+ require 'rouge'
56
2
 
57
3
  def self.pyg_change(code, klass, style)
58
4
  color = style[0..6]
@@ -82,13 +28,17 @@ module PygmentFix # Remove CSS for Jutoh
82
28
 
83
29
  def self.pyg_finalize(code, lexer=:elixir)
84
30
  Styles.each_pair {|klass, style| pyg_change(code, klass, style) }
31
+ File.open("debug-pf1", "w") {|f| f.puts code }
85
32
  code.sub!(/<pre>/, "<pre>\n")
86
33
  code.gsub!(/<span class="[np]">/, "")
87
34
  code.gsub!(/<\/span>/, "")
88
35
  color = _codebar_color(lexer)
89
- code.sub!(/<td class="linenos"/, "<td width=6%></td><td width=5% bgcolor=#{color}")
36
+ code.sub!(/<td class="linenos"/, "<td width=2%></td><td width=5% bgcolor=#{color}")
37
+ code.gsub!(/<td/, "<td valign=top ")
90
38
  code.gsub!(/ class="[^"]*?"/, "") # Get rid of remaining Pygments CSS
39
+ File.open("debug-pf2", "w") {|f| f.puts code }
91
40
  lines = code.split("\n")
41
+ # lines.each {|line| line << "\n" }
92
42
  n1 = lines.index {|x| x =~ /<pre>/ }
93
43
  n2 = lines.index {|x| x =~ /<\/pre>/ }
94
44
  # FIXME ?
@@ -97,15 +47,13 @@ module PygmentFix # Remove CSS for Jutoh
97
47
  lines[n1].sub!(/ 1$/, " 1 ")
98
48
  (n1+1).upto(n2) {|n| lines[n].replace(" " + lines[n] + " ") }
99
49
  code = lines.join("\n")
50
+ File.open("debug-pf3", "w") {|f| f.puts code }
100
51
  code
101
52
  end
102
- end
103
-
104
- # Was in 'bookish':
105
53
 
106
- # include PygmentFix
107
54
 
108
55
  def _process_code(text)
56
+ File.open("debug-pc1", "w") {|f| f.puts text }
109
57
  lines = text.split("\n")
110
58
  lines = lines.select {|x| x !~ /##~ omit/ }
111
59
  @refs = {}
@@ -117,28 +65,32 @@ def _process_code(text)
117
65
  end
118
66
  end
119
67
  lines.map! {|line| " " + line }
120
- text.replace(lines.join("\n"))
68
+ text2 = lines.join("\n")
69
+ File.open("debug-pc2", "w") {|f| f.puts text2 }
70
+ text.replace(text2)
121
71
  end
122
72
 
123
73
  def _colorize(code, lexer=:elixir)
124
74
  text = ::Pygments.highlight(code, lexer: lexer, options: {linenos: "table"})
125
75
  _debug "--- in _colorize: text = #{text.inspect}"
126
- PygmentFix.pyg_finalize(text, lexer)
127
- text
76
+ text2 = PygmentFix.pyg_finalize(text, lexer)
77
+ result = "<!-- colorized code -->\n" + text2
78
+ result
128
79
  end
129
80
 
130
81
  def _colorize!(code, lexer=:elixir)
131
82
  text = ::Pygments.highlight(code, lexer: lexer, options: {})
132
83
  _debug "--- in _colorize!: text = #{text.inspect}"
133
- PygmentFix.pyg_finalize(text, lexer)
134
- text
84
+ text2 = PygmentFix.pyg_finalize(text, lexer)
85
+ result = "<!-- colorized code -->\n" + text2
86
+ result
135
87
  end
136
88
 
137
- def ruby
89
+ def OLD_ruby
138
90
  file = @_args.first
139
91
  if file.nil?
140
92
  code = "# Ruby code\n"
141
- _body {|line| code << line }
93
+ _body {|line| code << line + "\n" }
142
94
  else
143
95
  code = "# Ruby code\n\n" + ::File.read(file)
144
96
  end
@@ -148,11 +100,11 @@ def ruby
148
100
  _out "\n#{html}\n "
149
101
  end
150
102
 
151
- def elixir
103
+ def OLD_elixir
152
104
  file = @_args.first
153
105
  if file.nil?
154
106
  code = ""
155
- _body {|line| code << line }
107
+ _body {|line| code << line + "\n" }
156
108
  else
157
109
  code = ::File.read(file)
158
110
  end
@@ -163,20 +115,10 @@ def elixir
163
115
  end
164
116
 
165
117
  def fragment
166
- # debug
167
- lexer = @_args.empty? ? :elixir : @_args.first.to_sym # ruby or elixir
168
- _debug "-- fragment: lexer = #{lexer.inspect}"
169
- code = ""
170
- code << "# Ruby code\n\n" if lexer == :ruby
171
- _body(true) {|line| code << " " + line }
172
- _debug "code = \n#{code}\n-----"
173
- params = "(code, lexer: #{lexer.inspect}, options: {})"
174
- _debug "-- pygments params = #{params}"
175
- text = _colorize!(code, lexer)
176
- text ||= "ERROR IN HIGHLIGHTER"
177
- _debug "text = \n#{text.inspect}\n-----"
178
- # PygmentFix.pyg_finalize(text, lexer)
179
- _out text + "\n<br>"
118
+ lang = @_args.empty? ? :elixir : @_args.first.to_sym # ruby or elixir
119
+ @_args = []
120
+ send(lang)
121
+ _out "\n"
180
122
  end
181
123
 
182
124
  def code # FIXME ?
@@ -186,8 +128,76 @@ end
186
128
 
187
129
  def mono
188
130
  _out "<pre>"
189
- _body(true) {|line| _out " " + line }
131
+ _body {|line| _out " " + line }
190
132
  _out "</pre>"
191
133
  end
192
134
 
135
+ def create_code_styles
136
+ dir = @_outdir || "."
137
+ theme, back = "Github", "white"
138
+ css = Rouge::Themes.const_get(theme).render(scope: '.rb_highlight')
139
+ added = <<~CSS
140
+ .rb_highlight {
141
+ font-family: 'Monaco', 'Andale Mono', 'Lucida Grande', 'Courier', 'Lucida Console', 'Courier New', monospace;
142
+ white-space: pre;
143
+ background-color: #{back}
144
+ }
145
+ CSS
146
+
147
+ css.gsub!(/{\n/, "{\n font-family: courier;")
148
+ css = added + "\n" + css
149
+ # STDERR.puts "Writing #{theme} theme to ruby.css"
150
+ File.write("#{dir}/ruby.css", css)
151
+
152
+ css = Rouge::Themes.const_get(theme).render(scope: '.ex_highlight')
153
+ added = added.sub(/rb/, "ex")
154
+ css.gsub!(/{\n/, "{\n font-family: courier;")
155
+ css = added + "\n" + css
156
+ # STDERR.puts "Writing #{theme} theme to elixir.css"
157
+ File.write("#{dir}/elixir.css", css)
158
+ end
159
+
193
160
 
161
+ def format_ruby(source, theme = "Github", back = "black")
162
+ # theme/back not used now
163
+ formatter = Rouge::Formatters::HTML.new
164
+ lexer = Rouge::Lexers::Ruby.new
165
+ body = formatter.format(lexer.lex(source))
166
+ text = "<div class=rb_highlight>#{body}</div>"
167
+ text
168
+ end
169
+
170
+ def format_elixir(source, theme = "Github", back = "black")
171
+ # theme/back not used now
172
+ formatter = Rouge::Formatters::HTML.new
173
+ lexer = Rouge::Lexers::Elixir.new
174
+ body = formatter.format(lexer.lex(source))
175
+ text = "<div class=ex_highlight>#{body}</div>"
176
+ text
177
+ end
178
+
179
+ def ruby
180
+ file = @_args.first
181
+ if file.nil?
182
+ code = " # Ruby code\n\n"
183
+ _body {|line| code << " " + line + "\n" }
184
+ else
185
+ code = "# Ruby code\n\n" + ::File.read(file)
186
+ end
187
+
188
+ html = format_ruby(code)
189
+ _out html
190
+ end
191
+
192
+ def elixir
193
+ file = @_args.first
194
+ if file.nil?
195
+ code = ""
196
+ _body {|line| code << " " + line + "\n" }
197
+ else
198
+ code = ::File.read(file)
199
+ end
200
+
201
+ html = format_elixir(code)
202
+ _out html
203
+ end
data/plugin/tutorial.rb CHANGED
@@ -1,27 +1,30 @@
1
1
  require 'cgi'
2
2
 
3
- def title
3
+ def title(args = nil, body = nil)
4
4
  h1
5
+ _optional_blank_line
5
6
  end
6
7
 
7
- def section
8
+ def section(args = nil, body = nil)
8
9
  h3
10
+ _optional_blank_line
9
11
  end
10
12
 
11
- def code
13
+ def code(args = nil, body = nil)
12
14
  first = true # dumb hack! fixes blank space
13
15
  _body do |line|
14
16
  tag, first = "<pre>", false if first
15
17
  _out "#{tag} #{::CGI.escape_html(line)}" # indentation
16
18
  end
17
19
  _out "</pre>"
20
+ _optional_blank_line
18
21
  end
19
22
 
20
23
  def rx(str)
21
24
  ::Regexp.compile(::Regexp.escape(str))
22
25
  end
23
26
 
24
- def inout
27
+ def inout(args = nil, body = nil)
25
28
  src, out = _args
26
29
  t1 = ::File.readlines(src) rescue (abort "t1 = #{src}")
27
30
  t2 = ::File.readlines(out) rescue (abort "t2 = #{out}")
@@ -45,6 +48,7 @@ def inout
45
48
  </tr>
46
49
  </table>
47
50
  HTML
51
+ _optional_blank_line
48
52
  end
49
53
 
50
54
  def put_table(src, exp)
@@ -73,11 +77,12 @@ def put_table(src, exp)
73
77
  HTML
74
78
  end
75
79
 
76
- def testcase
80
+ def testcase(args = nil, body = nil)
77
81
  name = _args.first
78
82
  _out "\n<font size=+1><b>Test: </font><font size=+2><tt>#{name}</tt></font></b></h3><br>"
79
83
  src, exp = "test/data/#{name}/source.lt3", "test/data/#{name}/expected-output.txt"
80
84
  @_args = [src, exp] # Better way to do this??
81
85
  put_table(src, exp)
82
86
  _out "<br>"
87
+ _optional_blank_line
83
88
  end
data/test/all.rb CHANGED
@@ -1,4 +1,3 @@
1
1
 
2
2
  require_relative 'unit/all'
3
3
  require_relative 'snapshots' # snapshots
4
- require_relative 'formatting-tests' # one-liners in input
@@ -1,10 +1,9 @@
1
1
  # Comments are ignored.
2
2
  # Other lines: name_of_snapshot and any comments here are ignored (no # needed)
3
- # fake_test_name Use # to un-omit ;)
4
- error_no_such_inc Output BEFORE error doesn't get passed through
5
- error_no_such_copy ^ Same behavior as error_no_such_inc
6
- simple_mixin Mixin doesn't work?? But no error... maybe _def isn't working.
7
- error_missing_end Output is duplicated somehow. Look for: puts @body or puts @main.body
8
- error_no_such_mixin ^ Same behavior as error_missing_end
9
- error_line_num Same behavior as error_missing_end
10
- error_invalid_name ^ Same behavior as error_no_such_inc
3
+ # fake_test_name Use # to un-omit ;)
4
+ error_no_such_inc Output BEFORE error doesn't get passed through
5
+ error_no_such_copy ^ Same behavior as error_no_such_inc
6
+ error_no_such_mixin ^ Same behavior as error_missing_end
7
+ error_invalid_name ^ Same behavior as error_no_such_inc
8
+ error_missing_end Output is duplicated somehow. Look for: puts @body or puts @main.body
9
+ error_inc_line_num Forgot what's wrong here
@@ -0,0 +1,35 @@
1
+ # Blank lines and comments are ignored.
2
+ # Other lines: name_of_snapshot and any comments here are ignored (no # needed)
3
+
4
+ # i to include, x to exclude
5
+
6
+ error_no_such_inc Output BEFORE error doesn't get passed through
7
+ error_no_such_copy ^ Same behavior as error_no_such_inc
8
+ error_no_such_mixin ^ Same behavior as error_missing_end
9
+ error_invalid_name ^ Same behavior as error_no_such_inc
10
+ error_missing_end Output is duplicated somehow. Look for: puts @body or puts @main.body
11
+ error_inc_line_num Forgot what's wrong here
12
+
13
+ basic_formatting
14
+ block_comment
15
+ comments_ignored_1
16
+ copy_is_raw
17
+ def_method
18
+ error_line_num
19
+ error_mismatched_end
20
+ error_name_not_permitted
21
+ example_alpha
22
+ example_alpha2
23
+ functions
24
+ hello_world
25
+ more_complex_vars
26
+ predef_vars
27
+ raw_lines
28
+ raw_text_block
29
+ simple_copy
30
+ simple_import
31
+ simple_include
32
+ simple_mixin
33
+ simple_vars
34
+ single_raw_line
35
+ table_with_heredocs
@@ -0,0 +1,14 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:64:in `handle_dotcmd': Name 'foobar' is unknown (RuntimeError)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:39:in `process_line'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:27:in `block in process_file'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `loop'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:210:in `dot_include'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `handle_dotcmd'
8
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:39:in `process_line'
9
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:27:in `block in process_file'
10
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `loop'
11
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `process_file'
12
+ from ../../../bin/livetext:88:in `block in <main>'
13
+ from ../../../bin/livetext:57:in `loop'
14
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1,7 @@
1
+ This is my
2
+ source file
3
+ which includes file2 here:
4
+ This is file2
5
+ which has an error
6
+ about an unknown command
7
+ in line 5
@@ -1 +1 @@
1
- 1 /Error: Name 'foobar' is unknown/
1
+ 1 /Name 'foobar' is unknown/
@@ -0,0 +1,14 @@
1
+ ACTUAL | EXPECTED
2
+ This is my This is my
3
+ source file source file
4
+ which includes file2 here: which includes file2 here:
5
+ This is file2 This is file2
6
+ which has an error which has an error
7
+ about an unknown command about an unknown command
8
+ in line 5 in line 5
9
+ > <p>
10
+ >
11
+ > And this is file2 line 7.
12
+ > And here we are
13
+ > back in the
14
+ > original file.
@@ -0,0 +1,10 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:83:in `check_disallowed': Error: name 'to_s' is invalid (DisallowedName)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:142:in `dot_def'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:39:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:27:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `process_file'
8
+ from ../../../bin/livetext:88:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -1 +1 @@
1
- 1 /Error: Illegal name 'to_s'/
1
+ 1 /name 'to_s' is invalid/
@@ -0,0 +1,6 @@
1
+ ACTUAL | EXPECTED
2
+ > This file has
3
+ > a defined method
4
+ > that is invalid:
5
+ > <p>
6
+ >
@@ -1 +1 @@
1
- 1 /Error: Name 'foobar' is unknown/
1
+ 1 /Name 'foobar' is unknown/
@@ -1 +1 @@
1
- 1 /Error: found .end with no opening command/
1
+ 1 /found .end with no opening command/
@@ -0,0 +1,10 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/userapi.rb:89:in `_body': Expected .end, found end of file (RuntimeError)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:48:in `comment'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:39:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:27:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `process_file'
8
+ from ../../../bin/livetext:88:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -1 +1 @@
1
- 1 /Error: Expected .end, found end of file/
1
+ 1 /Expected .end, found end of file/
@@ -0,0 +1,6 @@
1
+ ACTUAL | EXPECTED
2
+ > Blah
3
+ > blah
4
+ > <p>
5
+ >
6
+ >
@@ -0,0 +1,10 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:87:in `check_file_exists': Error: file 'nosuchfile.txt' not found (FileNotFound)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:248:in `copy'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:39:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:27:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `process_file'
8
+ from ../../../bin/livetext:88:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -1 +1 @@
1
- 1 /Error: file nosuchfile.txt not found/
1
+ 1 /file nosuchfile.txt not found/
@@ -0,0 +1,5 @@
1
+ ACTUAL | EXPECTED
2
+ > Make sure a
3
+ > nonexistent file with .copy
4
+ > gives an error.
5
+ > <p>
@@ -1,4 +1,3 @@
1
- .debug
2
1
  Make sure a
3
2
  nonexistent file with .copy
4
3
  gives an error.
@@ -0,0 +1,10 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:87:in `check_file_exists': Error: file 'nosuchinc.lt3' not found (FileNotFound)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:209:in `dot_include'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:39:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:27:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `process_file'
8
+ from ../../../bin/livetext:88:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -1 +1 @@
1
- 1 /Error: file nosuchinc.lt3 not found/
1
+ 1 /file nosuchinc.lt3 not found/
@@ -0,0 +1,6 @@
1
+ ACTUAL | EXPECTED
2
+ > Make sure
3
+ > a nonexistent include
4
+ > will give an error.
5
+ > <p>
6
+ >
@@ -0,0 +1,37 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:48:in `find_file': No such mixin 'nosuchthing' (RuntimeError)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `block in find_file'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `chdir'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `find_file'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `block in find_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `chdir'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `find_file'
8
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `block in find_file'
9
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `chdir'
10
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `find_file'
11
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `block in find_file'
12
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `chdir'
13
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `find_file'
14
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `block in find_file'
15
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `chdir'
16
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `find_file'
17
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `block in find_file'
18
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `chdir'
19
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `find_file'
20
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `block in find_file'
21
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `chdir'
22
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `find_file'
23
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `block in find_file'
24
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `chdir'
25
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:49:in `find_file'
26
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:16:in `initialize'
27
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:20:in `new'
28
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:20:in `get_module'
29
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:230:in `mixin'
30
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `handle_dotcmd'
31
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:39:in `process_line'
32
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:27:in `block in process_file'
33
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `loop'
34
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `process_file'
35
+ from ../../../bin/livetext:88:in `block in <main>'
36
+ from ../../../bin/livetext:57:in `loop'
37
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1,6 @@
1
+ ACTUAL | EXPECTED
2
+ > Test that
3
+ > we give an error
4
+ > when a mixin does not
5
+ > exist:
6
+ > <p>
@@ -0,0 +1,8 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:64:in `handle_dotcmd': Name 'hello_world' is unknown (RuntimeError)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:39:in `process_line'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:27:in `block in process_file'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `loop'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:24:in `process_file'
6
+ from ../../../bin/livetext:88:in `block in <main>'
7
+ from ../../../bin/livetext:57:in `loop'
8
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1,3 @@
1
+ Here I am
2
+ testing a simple import
3
+ Now call a method:
@@ -0,0 +1,9 @@
1
+ ACTUAL | EXPECTED
2
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:64:in ` <
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpe <
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpe <
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpe <
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpe <
7
+ from ../../../bin/livetext:88:in `block in <main>' <
8
+ from ../../../bin/livetext:57:in `loop' <
9
+ from ../../../bin/livetext:57:in `<main>' <
File without changes
@@ -0,0 +1,7 @@
1
+ Here I am
2
+ testing a simple import
3
+ <p>
4
+
5
+ Now call a method:
6
+ Hello, world.
7
+ That's all.
@@ -0,0 +1,9 @@
1
+ ACTUAL | EXPECTED
2
+ [:ARGF, :ARGV, :ArgumentError, :Array, :BadQuotedString, :B <
3
+ Here I am Here I am
4
+ testing a simple import testing a simple import
5
+ <p> <p>
6
+
7
+ Now call a method: Now call a method:
8
+ > Hello, world.
9
+ That's all. That's all.