livetext 0.9.22 → 0.9.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.lt3 +2 -2
  3. data/imports/tutorial.rb +1 -1
  4. data/lib/cmdargs.rb +2 -0
  5. data/lib/errors.rb +2 -0
  6. data/lib/formatline.rb +10 -108
  7. data/lib/funcall.rb +93 -0
  8. data/lib/functions.rb +1 -1
  9. data/lib/global_helpers.rb +39 -0
  10. data/lib/handler/import.rb +20 -11
  11. data/lib/handler.rb +2 -0
  12. data/lib/helpers.rb +12 -4
  13. data/lib/html.rb +2 -0
  14. data/lib/livetext.rb +23 -2
  15. data/lib/parser/file.rb +0 -2
  16. data/lib/parser/general.rb +0 -3
  17. data/lib/parser/mixin.rb +4 -8
  18. data/lib/parser/set.rb +0 -3
  19. data/lib/parser.rb +2 -0
  20. data/lib/parsing.rb +31 -0
  21. data/lib/processor.rb +65 -71
  22. data/lib/standard.rb +12 -1
  23. data/lib/userapi.rb +3 -1
  24. data/plugin/pyggish.rb +1 -0
  25. data/test/snapshots/error_inc_line_num/OUT +17 -0
  26. data/test/snapshots/error_inc_line_num/actual-error.txt +0 -14
  27. data/test/snapshots/error_inc_line_num/actual-output.txt +10 -0
  28. data/test/snapshots/error_invalid_name/actual-error.txt +6 -6
  29. data/test/snapshots/error_missing_end/actual-error.txt +5 -5
  30. data/test/snapshots/error_no_such_copy/actual-error.txt +7 -7
  31. data/test/snapshots/error_no_such_copy/match-error.txt +1 -1
  32. data/test/snapshots/error_no_such_copy/out-sdiff.txt +5 -0
  33. data/test/snapshots/error_no_such_inc/actual-error.txt +6 -6
  34. data/test/snapshots/error_no_such_inc/match-error.txt +1 -1
  35. data/test/snapshots/error_no_such_inc/out-sdiff.txt +6 -0
  36. data/test/snapshots/error_no_such_mixin/actual-error.txt +7 -7
  37. data/test/snapshots/{wtf_bookish → import_bookish}/expected-error.txt +0 -0
  38. data/test/snapshots/{wtf_bookish → import_bookish}/expected-output.txt +0 -0
  39. data/test/snapshots/{wtf_bookish → import_bookish}/source.lt3 +0 -0
  40. data/test/snapshots/{wtf_bookish → import_bookish}/toc.tmp +0 -0
  41. data/test/snapshots/{import/actual-output.txt → mixin_bookish/expected-error.txt} +0 -0
  42. data/test/snapshots/mixin_bookish/expected-output.txt +10 -0
  43. data/test/snapshots/mixin_bookish/source.lt3 +7 -0
  44. data/test/snapshots/mixin_bookish/toc.tmp +0 -0
  45. data/test/snapshots/subset.txt +4 -3
  46. data/test/snapshots.rb +15 -6
  47. data/test/unit/formatline.rb +2 -0
  48. data/test/unit/html.rb +1 -1
  49. data/test/unit/parser/general.rb +1 -2
  50. data/test/unit/parser/mixin.rb +1 -3
  51. data/test/unit/parser/set.rb +2 -2
  52. data/test/unit/parser/string.rb +1 -1
  53. data/test/unit/parser.rb +0 -1
  54. metadata +16 -12
  55. data/imports/markdown_importable.rb +0 -45
  56. data/test/snapshots/error_inc_line_num/out-sdiff.txt +0 -14
  57. data/test/snapshots/import/actual-error.txt +0 -13
  58. data/test/snapshots/import/out-sdiff.txt +0 -6
  59. data/test/unit/parser/importable.rb +0 -19
data/lib/processor.rb CHANGED
@@ -1,87 +1,81 @@
1
- # Class Livetext is the actual top-level class.
1
+ # p __FILE__
2
2
 
3
- class Livetext
4
3
 
5
- def self.interpolate(str)
6
- FormatLine.var_func_parse(str)
7
- end
8
-
9
- # Class Processor does the actual work of processing input.
4
+ # Class Processor does the actual work of processing input.
10
5
 
11
- class Processor
6
+ class Processor
12
7
 
13
- GenericError = Class.new(StandardError)
8
+ GenericError = Class.new(StandardError)
14
9
 
15
- include Livetext::Standard
16
- include Livetext::UserAPI
10
+ include Livetext::Standard
11
+ include Livetext::UserAPI
17
12
 
18
- Disallowed =
19
- %i[ __binding__ __id__ __send__ class
20
- clone display dup enum_for
21
- eql? equal? extend freeze
22
- frozen? hash inspect instance_eval
23
- instance_exec instance_of? is_a? kind_of?
24
- method methods nil? object_id
25
- pretty_inspect private_methods protected_methods public_method
26
- public_methods public_send respond_to? send
27
- singleton_class singleton_method singleton_methods taint
28
- tainted? tap to_enum to_s
29
- trust untaint untrust untrusted?
30
- define_singleton_method instance_variable_defined?
31
- instance_variable_get instance_variable_set
32
- remove_instance_variable instance_variables ]
13
+ Disallowed =
14
+ %i[ __binding__ __id__ __send__ class
15
+ clone display dup enum_for
16
+ eql? equal? extend freeze
17
+ frozen? hash inspect instance_eval
18
+ instance_exec instance_of? is_a? kind_of?
19
+ method methods nil? object_id
20
+ pretty_inspect private_methods protected_methods public_method
21
+ public_methods public_send respond_to? send
22
+ singleton_class singleton_method singleton_methods taint
23
+ tainted? tap to_enum to_s
24
+ trust untaint untrust untrusted?
25
+ define_singleton_method instance_variable_defined?
26
+ instance_variable_get instance_variable_set
27
+ remove_instance_variable instance_variables ]
33
28
 
34
- def initialize(parent, output = nil)
35
- @parent = parent
36
- @_nopass = false
37
- @_nopara = false
38
- # Meh?
39
- @output = ::Livetext.output = (output || File.open("/dev/null", "w"))
40
- @sources = []
41
- @indentation = @parent.indentation
42
- @_mixins = []
43
- end
29
+ def initialize(parent, output = nil)
30
+ @parent = parent
31
+ @_nopass = false
32
+ @_nopara = false
33
+ # Meh?
34
+ @output = ::Livetext.output = (output || File.open("/dev/null", "w"))
35
+ @sources = []
36
+ @indentation = @parent.indentation
37
+ @_mixins = []
38
+ end
44
39
 
45
- def output=(io)
46
- @output = io
47
- end
40
+ def output=(io)
41
+ @output = io
42
+ end
48
43
 
49
- def error(*args)
50
- ::STDERR.puts *args
51
- end
44
+ def error(*args)
45
+ ::STDERR.puts *args
46
+ end
52
47
 
53
- def _error!(err, raise_error=false, trace=false) # FIXME much bullshit happens here
54
- where = @sources.last || @save_location
55
- error "Error: #{err} (at #{where[1]} line #{where[2]})"
56
- error(err.backtrace) rescue nil
57
- raise GenericError.new("Error: #{err}") if raise_error
58
- end
48
+ def _error!(err, raise_error=false, trace=false) # FIXME much bullshit happens here
49
+ where = @sources.last || @save_location
50
+ error "Error: #{err} (at #{where[1]} line #{where[2]})"
51
+ error(err.backtrace) rescue nil
52
+ raise GenericError.new("Error: #{err}") if raise_error
53
+ end
59
54
 
60
- def disallowed?(name)
61
- Disallowed.include?(name.to_sym)
62
- end
55
+ def disallowed?(name)
56
+ Disallowed.include?(name.to_sym)
57
+ end
63
58
 
64
- def source(enum, file, line)
65
- @sources.push([enum, file, line])
66
- end
59
+ def source(enum, file, line)
60
+ @sources.push([enum, file, line])
61
+ end
67
62
 
68
- def peek_nextline
69
- line = @sources.last[0].peek
70
- rescue StopIteration
71
- @sources.pop
72
- nil
73
- rescue => err
74
- nil
75
- end
63
+ def peek_nextline
64
+ line = @sources.last[0].peek
65
+ rescue StopIteration
66
+ @sources.pop
67
+ nil
68
+ rescue => err
69
+ nil
70
+ end
76
71
 
77
- def nextline
78
- return nil if @sources.empty?
79
- line = @sources.last[0].next
80
- @sources.last[2] += 1
81
- line
82
- rescue StopIteration
83
- @sources.pop
84
- nil
85
- end
72
+ def nextline
73
+ return nil if @sources.empty?
74
+ line = @sources.last[0].next
75
+ @sources.last[2] += 1
76
+ line
77
+ rescue StopIteration
78
+ @sources.pop
79
+ nil
86
80
  end
87
81
  end
data/lib/standard.rb CHANGED
@@ -1,7 +1,10 @@
1
+ # p __FILE__
2
+
1
3
  require 'pathname' # For _seek - remove later??
2
4
 
3
5
  require_relative 'parser' # nested requires
4
6
  require_relative 'html'
7
+ require_relative 'global_helpers'
5
8
  require_relative 'helpers'
6
9
 
7
10
  make_exception(:ExpectedOnOff, "Error: expected 'on' or 'off'")
@@ -14,7 +17,7 @@ make_exception(:FileNotFound, "Error: file '%1' not found")
14
17
  module Livetext::Standard
15
18
 
16
19
  include HTMLHelper
17
- include Helpers
20
+ include Livetext::Helpers
18
21
 
19
22
  SimpleFormats = # Move this?
20
23
  { b: %w[<b> </b>],
@@ -209,6 +212,14 @@ module Livetext::Standard
209
212
  check_file_exists(file)
210
213
  @parent.process_file(file)
211
214
  _optional_blank_line
215
+ rescue StandardError => err
216
+ p err
217
+ puts "-----"
218
+ err.backtrace.to_a.each {|x| puts x }
219
+ puts "-----"
220
+ exit
221
+ TTY.puts ">>> #{__method__}: rescue in process_file!!"
222
+ # _out @body
212
223
  end
213
224
 
214
225
  def inherit(args = nil, body = nil)
data/lib/userapi.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # p __FILE__
2
+
1
3
  require_relative 'formatline'
2
4
 
3
5
  # UserAPI deals mostly with user-level methods.
@@ -117,7 +119,7 @@ module Livetext::UserAPI
117
119
 
118
120
  def _format(line)
119
121
  return "" if line == "\n" || line.nil?
120
- line2 = FormatLine.parse!(line)
122
+ line2 = Livetext::FormatLine.parse!(line)
121
123
  line.replace(line2)
122
124
  line
123
125
  end
data/plugin/pyggish.rb CHANGED
@@ -85,6 +85,7 @@ end
85
85
  def fragment
86
86
  lang = @_args.empty? ? :elixir : @_args.first.to_sym # ruby or elixir
87
87
  @_args = []
88
+ # TTY.puts "\n#{self.inspect}"
88
89
  send(lang)
89
90
  _out "\n"
90
91
  end
@@ -0,0 +1,17 @@
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
8
+ This is my
9
+ source file
10
+ which includes file2 here:
11
+ This is file2
12
+ which has an error
13
+ about an unknown command
14
+ in line 5
15
+ <p>
16
+
17
+ And this is file2 line 7.
@@ -1,14 +0,0 @@
1
- /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:121:in `handle_dotcmd': Name 'foobar' is unknown (RuntimeError)
2
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
3
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
4
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
5
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58: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:95:in `handle_dotcmd'
8
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
9
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
10
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
11
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `process_file'
12
- from ../../../bin/livetext:86:in `block in <main>'
13
- from ../../../bin/livetext:57:in `loop'
14
- from ../../../bin/livetext:57:in `<main>'
@@ -5,3 +5,13 @@ which includes file2 here:
5
5
  which has an error
6
6
  about an unknown command
7
7
  in line 5
8
+ This is my
9
+ source file
10
+ which includes file2 here:
11
+ This is file2
12
+ which has an error
13
+ about an unknown command
14
+ in line 5
15
+ <p>
16
+
17
+ And this is file2 line 7.
@@ -1,10 +1,10 @@
1
- /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:140:in `check_disallowed': Error: name 'to_s' is invalid (DisallowedName)
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:146:in `check_disallowed': Error: name 'to_s' is invalid (DisallowedName)
2
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:95:in `handle_dotcmd'
4
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
5
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
6
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
7
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `process_file'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:101:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:79:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:63:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `process_file'
8
8
  from ../../../bin/livetext:86:in `block in <main>'
9
9
  from ../../../bin/livetext:57:in `loop'
10
10
  from ../../../bin/livetext:57:in `<main>'
@@ -1,10 +1,10 @@
1
1
  /Users/Hal/Dropbox/topx/git/livetext/lib/userapi.rb:92:in `_body': Expected .end, found end of file (RuntimeError)
2
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:95:in `handle_dotcmd'
4
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
5
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
6
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
7
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `process_file'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:101:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:79:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:63:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `process_file'
8
8
  from ../../../bin/livetext:86:in `block in <main>'
9
9
  from ../../../bin/livetext:57:in `loop'
10
10
  from ../../../bin/livetext:57:in `<main>'
@@ -1,10 +1,10 @@
1
- /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:144:in `check_file_exists': Error: file 'nosuchfile.txt' not found (FileNotFound)
2
- from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:252:in `copy'
3
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:95:in `handle_dotcmd'
4
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
5
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
6
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
7
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `process_file'
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:150:in `check_file_exists': Error: file 'nosuchfile.txt' not found (FileNotFound)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:255:in `copy'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:101:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:79:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:63:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `process_file'
8
8
  from ../../../bin/livetext:86:in `block in <main>'
9
9
  from ../../../bin/livetext:57:in `loop'
10
10
  from ../../../bin/livetext:57:in `<main>'
@@ -1 +1 @@
1
- 1 /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,10 +1,10 @@
1
- /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:144:in `check_file_exists': Error: file 'nosuchinc.lt3' not found (FileNotFound)
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:150:in `check_file_exists': Error: file 'nosuchinc.lt3' not found (FileNotFound)
2
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:95:in `handle_dotcmd'
4
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
5
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
6
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
7
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `process_file'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:101:in `handle_dotcmd'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:79:in `process_line'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:63:in `block in process_file'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `loop'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `process_file'
8
8
  from ../../../bin/livetext:86:in `block in <main>'
9
9
  from ../../../bin/livetext:57:in `loop'
10
10
  from ../../../bin/livetext:57:in `<main>'
@@ -1 +1 @@
1
- 1 /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
+ >
@@ -1,13 +1,13 @@
1
- /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:34:in `find_file': No such mixin 'nosuchthing' (RuntimeError)
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:36:in `find_file': No such mixin 'nosuchthing' (RuntimeError)
2
2
  from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:12:in `initialize'
3
3
  from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:16:in `new'
4
4
  from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:16:in `get_module'
5
- from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:231:in `mixin'
6
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:95:in `handle_dotcmd'
7
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:73:in `process_line'
8
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:61:in `block in process_file'
9
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `loop'
10
- from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:58:in `process_file'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:234:in `mixin'
6
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:101:in `handle_dotcmd'
7
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:79:in `process_line'
8
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:63:in `block in process_file'
9
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `loop'
10
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:60:in `process_file'
11
11
  from ../../../bin/livetext:86:in `block in <main>'
12
12
  from ../../../bin/livetext:57:in `loop'
13
13
  from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1,10 @@
1
+ <table cellpadding=2>
2
+ <tr>
3
+ <td width=[0, 0]% valign=top>this</td>
4
+ <td width=[0, 0]% valign=top>that</td>
5
+ </tr>
6
+ <tr>
7
+ <td width=[0, 0]% valign=top>foo</td>
8
+ <td width=[0, 0]% valign=top>bar</td>
9
+ </tr>
10
+ </table>
@@ -0,0 +1,7 @@
1
+ .mixin bookish
2
+
3
+ .simple_table
4
+ this :: that
5
+ foo :: bar
6
+ .end
7
+
File without changes
@@ -1,4 +1,4 @@
1
- # This file specifies which snapshots will/won't be run.
1
+ h This file specifies which snapshots will/won't be run.
2
2
 
3
3
  # Blank lines and comments are ignored.
4
4
  # Other lines: name_of_snapshot and any comments here are ignored (no # needed)
@@ -33,8 +33,9 @@ x error_no_such_mixin # ^ Same behavior as error_missing_end
33
33
  simple_mixin #
34
34
  x import # "Leading" output doesn't get generated (same as error_no_such_inc)
35
35
  import2 #
36
-
37
-
36
+ mixin_bookish #
37
+ import_bookish #
38
+
38
39
  # raw input
39
40
 
40
41
  single_raw_line #
data/test/snapshots.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'minitest/autorun'
1
2
 
2
3
  require_relative '../lib/livetext'
3
4
 
@@ -54,13 +55,24 @@ class TestingLivetext < MiniTest::Test
54
55
  end
55
56
  end
56
57
 
57
- args = ARGV - ["cmdline"]
58
+ Args = ARGV - ["cmdline"]
58
59
  dir = self.get_dir
59
60
  Data = "#{dir}test/snapshots"
60
61
  Dir.chdir(Data)
61
62
  TestDirs = Dir.entries(".").reject {|fname| ! File.directory?(fname) } - %w[. ..]
62
63
 
64
+ Specified = []
65
+ Args.each do |name|
66
+ which = TestDirs.select {|tdir| Regexp.new(name) =~ tdir }
67
+ which.each {|item| Specified << item }
68
+ end
69
+ Specified.uniq!
70
+
63
71
  def self.filter
72
+ unless Args.empty?
73
+ puts "Running: #{Args.map {|arg| "/#{arg}/" }}"
74
+ return Args
75
+ end
64
76
  all = Dir.entries(".").reject {|fname| ! File.directory?(fname) } - %w[. ..]
65
77
  @included, @excluded = all, []
66
78
  @reasons = []
@@ -108,10 +120,6 @@ class TestingLivetext < MiniTest::Test
108
120
  @included - @excluded
109
121
  end
110
122
 
111
- def after_suites
112
- puts "Woohoo!"
113
- end
114
-
115
123
  def initialize(base, assertion = nil)
116
124
  @assertion = assertion
117
125
  @base = base
@@ -190,7 +198,8 @@ class TestingLivetext < MiniTest::Test
190
198
  end
191
199
  end
192
200
 
193
- Subset = Snapshot.filter
201
+ Subset = Specified = Snapshot::Specified
202
+ Subset.replace(Snapshot.filter) if Specified.empty?
194
203
 
195
204
  Subset.each do |tdir|
196
205
  define_method("test_#{tdir}") do
@@ -4,6 +4,8 @@ require_relative '../../lib/livetext'
4
4
 
5
5
  class TestingLivetext < MiniTest::Test
6
6
 
7
+ FormatLine = Livetext::FormatLine
8
+
7
9
  # Some (most) methods were generated via the code
8
10
  # seen in the comment at the bottom of this file...
9
11
 
data/test/unit/html.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'minitest/autorun'
2
2
 
3
- require '../../lib/livetext'
3
+ require 'livetext'
4
4
 
5
5
  class TestingLivetext < MiniTest::Test
6
6
  include Livetext::Standard
@@ -1,7 +1,7 @@
1
1
 
2
2
  require 'minitest/autorun'
3
3
 
4
- require_relative '../../../lib/parser/general'
4
+ require_relative '../parser' # nested
5
5
 
6
6
  ParseGeneral = ::Livetext::ParseGeneral
7
7
 
@@ -53,7 +53,6 @@ class TestParseGeneral < MiniTest::Test
53
53
  vars = ["alpha 'simple string'", 'beta "another string"']
54
54
  expect = [["this.that.alpha", "'simple string'"], ["this.that.beta", '"another string"']]
55
55
  assert_equal ParseGeneral.parse_vars(vars, prefix: "this.that"), expect
56
-
57
56
  end
58
57
 
59
58
  end
@@ -1,9 +1,7 @@
1
1
 
2
2
  require 'minitest/autorun'
3
3
 
4
- require_relative '../../../lib/parser/set'
5
-
6
- # ParseSet = Livetext::ParseSet
4
+ require_relative '../parser' # nested
7
5
 
8
6
  class TestParseSet < MiniTest::Test
9
7
 
@@ -1,9 +1,9 @@
1
1
 
2
2
  require 'minitest/autorun'
3
3
 
4
- require_relative '../../../lib/parser/set'
4
+ require_relative '../parser' # nested
5
5
 
6
- ParseSet = Livetext::ParseSet
6
+ ParseSet = ::Livetext::ParseSet
7
7
 
8
8
  class TestParseSet < MiniTest::Test
9
9
 
@@ -1,6 +1,6 @@
1
1
  require 'minitest/autorun'
2
2
 
3
- require_relative '../../../lib/parser/string'
3
+ require_relative '../parser' # nested
4
4
 
5
5
  class TestStringParser < MiniTest::Test
6
6
 
data/test/unit/parser.rb CHANGED
@@ -3,4 +3,3 @@ require_relative 'parser/string'
3
3
  require_relative 'parser/set'
4
4
  require_relative 'parser/general'
5
5
  require_relative 'parser/mixin' # currently empty
6
- require_relative 'parser/importable' # currently empty