livetext 0.9.22 → 0.9.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.lt3 +2 -2
- data/imports/tutorial.rb +1 -1
- data/lib/cmdargs.rb +2 -0
- data/lib/errors.rb +2 -0
- data/lib/formatline.rb +10 -108
- data/lib/funcall.rb +93 -0
- data/lib/functions.rb +1 -1
- data/lib/global_helpers.rb +39 -0
- data/lib/handler/import.rb +20 -11
- data/lib/handler.rb +2 -0
- data/lib/helpers.rb +12 -4
- data/lib/html.rb +2 -0
- data/lib/livetext.rb +23 -2
- data/lib/parser/file.rb +0 -2
- data/lib/parser/general.rb +0 -3
- data/lib/parser/mixin.rb +4 -8
- data/lib/parser/set.rb +0 -3
- data/lib/parser.rb +2 -0
- data/lib/parsing.rb +31 -0
- data/lib/processor.rb +65 -71
- data/lib/standard.rb +12 -1
- data/lib/userapi.rb +3 -1
- data/plugin/pyggish.rb +1 -0
- data/test/snapshots/error_inc_line_num/OUT +17 -0
- data/test/snapshots/error_inc_line_num/actual-error.txt +0 -14
- data/test/snapshots/error_inc_line_num/actual-output.txt +10 -0
- data/test/snapshots/error_invalid_name/actual-error.txt +6 -6
- data/test/snapshots/error_missing_end/actual-error.txt +5 -5
- data/test/snapshots/error_no_such_copy/actual-error.txt +7 -7
- data/test/snapshots/error_no_such_copy/match-error.txt +1 -1
- data/test/snapshots/error_no_such_copy/out-sdiff.txt +5 -0
- data/test/snapshots/error_no_such_inc/actual-error.txt +6 -6
- data/test/snapshots/error_no_such_inc/match-error.txt +1 -1
- data/test/snapshots/error_no_such_inc/out-sdiff.txt +6 -0
- data/test/snapshots/error_no_such_mixin/actual-error.txt +7 -7
- data/test/snapshots/{wtf_bookish → import_bookish}/expected-error.txt +0 -0
- data/test/snapshots/{wtf_bookish → import_bookish}/expected-output.txt +0 -0
- data/test/snapshots/{wtf_bookish → import_bookish}/source.lt3 +0 -0
- data/test/snapshots/{wtf_bookish → import_bookish}/toc.tmp +0 -0
- data/test/snapshots/{import/actual-output.txt → mixin_bookish/expected-error.txt} +0 -0
- data/test/snapshots/mixin_bookish/expected-output.txt +10 -0
- data/test/snapshots/mixin_bookish/source.lt3 +7 -0
- data/test/snapshots/mixin_bookish/toc.tmp +0 -0
- data/test/snapshots/subset.txt +4 -3
- data/test/snapshots.rb +15 -6
- data/test/unit/formatline.rb +2 -0
- data/test/unit/html.rb +1 -1
- data/test/unit/parser/general.rb +1 -2
- data/test/unit/parser/mixin.rb +1 -3
- data/test/unit/parser/set.rb +2 -2
- data/test/unit/parser/string.rb +1 -1
- data/test/unit/parser.rb +0 -1
- metadata +16 -12
- data/imports/markdown_importable.rb +0 -45
- data/test/snapshots/error_inc_line_num/out-sdiff.txt +0 -14
- data/test/snapshots/import/actual-error.txt +0 -13
- data/test/snapshots/import/out-sdiff.txt +0 -6
- data/test/unit/parser/importable.rb +0 -19
data/lib/processor.rb
CHANGED
@@ -1,87 +1,81 @@
|
|
1
|
-
#
|
1
|
+
# p __FILE__
|
2
2
|
|
3
|
-
class Livetext
|
4
3
|
|
5
|
-
|
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
|
-
|
6
|
+
class Processor
|
12
7
|
|
13
|
-
|
8
|
+
GenericError = Class.new(StandardError)
|
14
9
|
|
15
|
-
|
16
|
-
|
10
|
+
include Livetext::Standard
|
11
|
+
include Livetext::UserAPI
|
17
12
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
-
|
46
|
-
|
47
|
-
|
40
|
+
def output=(io)
|
41
|
+
@output = io
|
42
|
+
end
|
48
43
|
|
49
|
-
|
50
|
-
|
51
|
-
|
44
|
+
def error(*args)
|
45
|
+
::STDERR.puts *args
|
46
|
+
end
|
52
47
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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
|
-
|
61
|
-
|
62
|
-
|
55
|
+
def disallowed?(name)
|
56
|
+
Disallowed.include?(name.to_sym)
|
57
|
+
end
|
63
58
|
|
64
|
-
|
65
|
-
|
66
|
-
|
59
|
+
def source(enum, file, line)
|
60
|
+
@sources.push([enum, file, line])
|
61
|
+
end
|
67
62
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
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
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
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
@@ -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:
|
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:
|
4
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
5
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
6
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
7
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
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:
|
4
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
5
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
6
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
7
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
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:
|
2
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:
|
3
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
4
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
5
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
6
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
7
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
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/
|
@@ -1,10 +1,10 @@
|
|
1
|
-
/Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
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:
|
4
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
5
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
6
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
7
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
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/
|
@@ -1,13 +1,13 @@
|
|
1
|
-
/Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
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:
|
6
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
7
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
8
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
9
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
10
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:
|
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>'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/test/snapshots/subset.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
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
|
-
|
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
|
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
|
data/test/unit/formatline.rb
CHANGED
data/test/unit/html.rb
CHANGED
data/test/unit/parser/general.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
require 'minitest/autorun'
|
3
3
|
|
4
|
-
require_relative '
|
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
|
data/test/unit/parser/mixin.rb
CHANGED
data/test/unit/parser/set.rb
CHANGED
data/test/unit/parser/string.rb
CHANGED
data/test/unit/parser.rb
CHANGED