livetext 0.9.17 → 0.9.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/README.lt3 +2 -0
  3. data/README.md +330 -339
  4. data/bin/livetext +0 -2
  5. data/imports/bookish.rb +286 -0
  6. data/imports/calibre.rb +28 -0
  7. data/imports/livemagick.rb +133 -0
  8. data/imports/markdown.rb +44 -0
  9. data/imports/markdown_importable.rb +45 -0
  10. data/imports/pyggish.rb +172 -0
  11. data/imports/tutorial.rb +95 -0
  12. data/lib/cmdargs.rb +28 -20
  13. data/lib/formatline.rb +103 -75
  14. data/lib/functions.rb +16 -1
  15. data/lib/handler/{icanhaz.rb → import.rb} +1 -1
  16. data/lib/handler.rb +1 -1
  17. data/lib/helpers.rb +34 -8
  18. data/lib/livetext.rb +12 -5
  19. data/lib/parser/general.rb +1 -1
  20. data/lib/parser/set.rb +3 -5
  21. data/lib/parser/string.rb +11 -10
  22. data/lib/processor.rb +25 -13
  23. data/lib/standard.rb +16 -16
  24. data/lib/userapi.rb +6 -4
  25. data/livetext.gemspec +2 -1
  26. data/plugin/bookish.rb +4 -5
  27. data/plugin/markdown.rb +6 -6
  28. data/plugin/pyggish.rb +45 -77
  29. data/plugin/tutorial.rb +3 -3
  30. data/test/snapshots/error_inc_line_num/actual-error.txt +14 -0
  31. data/test/snapshots/error_inc_line_num/actual-output.txt +7 -0
  32. data/test/snapshots/error_inc_line_num/out-sdiff.txt +14 -0
  33. data/test/snapshots/error_invalid_name/actual-error.txt +10 -0
  34. data/test/snapshots/{icanhaz2/expected-error.txt → error_invalid_name/actual-output.txt} +0 -0
  35. data/test/snapshots/error_invalid_name/out-sdiff.txt +6 -0
  36. data/test/snapshots/error_missing_end/actual-error.txt +10 -0
  37. data/test/snapshots/error_missing_end/actual-output.txt +0 -0
  38. data/test/snapshots/error_missing_end/out-sdiff.txt +6 -0
  39. data/test/snapshots/error_no_such_copy/actual-error.txt +10 -0
  40. data/test/snapshots/error_no_such_copy/actual-output.txt +0 -0
  41. data/test/snapshots/error_no_such_inc/actual-error.txt +10 -0
  42. data/test/snapshots/error_no_such_inc/actual-output.txt +0 -0
  43. data/test/snapshots/error_no_such_mixin/actual-error.txt +13 -0
  44. data/test/snapshots/error_no_such_mixin/actual-output.txt +0 -0
  45. data/test/snapshots/error_no_such_mixin/out-sdiff.txt +6 -0
  46. data/test/snapshots/import/actual-error.txt +13 -0
  47. data/test/snapshots/import/actual-output.txt +0 -0
  48. data/test/snapshots/{icanhaz → import}/expected-output.txt +0 -0
  49. data/test/snapshots/{icanhaz → import}/match-error.txt +0 -0
  50. data/test/snapshots/import/out-sdiff.txt +6 -0
  51. data/test/snapshots/{icanhaz → import}/simple_import.rb +0 -0
  52. data/test/snapshots/{icanhaz → import}/source.lt3 +2 -2
  53. data/test/snapshots/import2/expected-error.txt +0 -0
  54. data/test/snapshots/{icanhaz2 → import2}/expected-output.txt +3 -1
  55. data/test/snapshots/{icanhaz2/simple_canhaz.rb → import2/simple_import.rb} +0 -0
  56. data/test/snapshots/import2/source.lt3 +8 -0
  57. data/test/snapshots/more_functions/expected-error.txt +0 -0
  58. data/test/snapshots/more_functions/expected-output.txt +37 -0
  59. data/test/snapshots/more_functions/source.lt3 +40 -0
  60. data/test/snapshots/simple_import/expected-output.txt +2 -0
  61. data/test/snapshots/simple_import/source.lt3 +3 -1
  62. data/test/snapshots/subset.txt +83 -0
  63. data/test/snapshots/wtf_bookish/expected-error.txt +0 -0
  64. data/test/snapshots/wtf_bookish/expected-output.txt +10 -0
  65. data/test/snapshots/wtf_bookish/source.lt3 +7 -0
  66. data/test/snapshots/wtf_bookish/toc.tmp +0 -0
  67. data/test/snapshots.rb +71 -46
  68. data/test/unit/formatline.rb +252 -135
  69. data/test/unit/parser/set.rb +20 -22
  70. data/test/unit/parser/string.rb +45 -6
  71. data/test/unit/standard.rb +0 -1
  72. metadata +44 -22
  73. data/lib/livetext/importable.rb +0 -2
  74. data/lib/parser/import.rb +0 -15
  75. data/test/affirm/kbks.jpg +0 -0
  76. data/test/affirm/lm-kbks.lt +0 -19
  77. data/test/cleanup +0 -1
  78. data/test/newtest +0 -14
  79. data/test/sdtest +0 -6
  80. data/test/snapshots/OMIT.txt +0 -11
  81. data/test/snapshots/clusion.txt +0 -70
  82. data/test/snapshots/crap +0 -16
  83. data/test/snapshots/fixit +0 -6
  84. data/test/snapshots/icanhaz2/source.lt3 +0 -6
@@ -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:140: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: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'
8
+ from ../../../bin/livetext:86:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1,6 @@
1
+ ACTUAL | EXPECTED
2
+ > This file has
3
+ > a defined method
4
+ > that is invalid:
5
+ > <p>
6
+ >
@@ -0,0 +1,10 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/userapi.rb:92: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: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'
8
+ from ../../../bin/livetext:86:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -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: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'
8
+ from ../../../bin/livetext:86:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1,10 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:144: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: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'
8
+ from ../../../bin/livetext:86:in `block in <main>'
9
+ from ../../../bin/livetext:57:in `loop'
10
+ from ../../../bin/livetext:57:in `<main>'
@@ -0,0 +1,13 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:34:in `find_file': No such mixin 'nosuchthing' (RuntimeError)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:12:in `initialize'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/parser/mixin.rb:16:in `new'
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'
11
+ from ../../../bin/livetext:86:in `block in <main>'
12
+ from ../../../bin/livetext:57:in `loop'
13
+ 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,13 @@
1
+ /Users/Hal/Dropbox/topx/git/livetext/lib/helpers.rb:34:in `find_file': No such mixin 'nonexistent' (RuntimeError)
2
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/handler/import.rb:9:in `initialize'
3
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/handler/import.rb:13:in `new'
4
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/handler/import.rb:13:in `get_module'
5
+ from /Users/Hal/Dropbox/topx/git/livetext/lib/standard.rb:243:in `import'
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'
11
+ from ../../../bin/livetext:86:in `block in <main>'
12
+ from ../../../bin/livetext:57:in `loop'
13
+ from ../../../bin/livetext:57:in `<main>'
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ ACTUAL | EXPECTED
2
+ > Test fake command .icanhaz:
3
+ > we give an error
4
+ > when a .rb does not
5
+ > exist:
6
+ > <p>
File without changes
@@ -1,9 +1,9 @@
1
- Test fake command .icanhaz:
1
+ Test .import:
2
2
  we give an error
3
3
  when a .rb does not
4
4
  exist:
5
5
 
6
- .icanhaz nonexistent
6
+ .import nonexistent
7
7
 
8
8
  We shouldn't
9
9
  reach this point
File without changes
@@ -1,6 +1,8 @@
1
- Testing fake command .icanhaz:
1
+ Testing .import:
2
2
  <p>
3
3
 
4
4
  Now call a method:
5
5
  Hello, world.
6
+ <p>
7
+
6
8
  That's all.
@@ -0,0 +1,8 @@
1
+ Testing .import:
2
+
3
+ .import simple_import
4
+
5
+ Now call a method:
6
+ .hello_world
7
+
8
+ That's all.
File without changes
@@ -0,0 +1,37 @@
1
+ Testing some more functions here...
2
+ <p>
3
+
4
+ Here I am calling a function with
5
+ a colon parameter...
6
+ <p>
7
+
8
+ <p>
9
+
10
+ Next let's <b>do*</b> something with our parameter:
11
+ <p>
12
+
13
+ I'll call these variants...
14
+ <p>
15
+
16
+ "Motel" spelled backwards is letom :)
17
+ <p>
18
+
19
+ "lamina" reversed is animal
20
+ <p>
21
+
22
+ I can also use the erutaef tekcarb here.
23
+ <p>
24
+
25
+ If I don't use a parameter for [Error evaluating $$reverse()] - it gives
26
+ me an error. (Bug or feature??)
27
+ <p>
28
+
29
+ What if a function doesn't use parameters at all, but
30
+ we pass them? Hmm...
31
+ <p>
32
+
33
+ Now we succeed and succeed some more
34
+ and finally we succeed in life.
35
+ <p>
36
+
37
+ But can we succeed, when our beds are burning?
@@ -0,0 +1,40 @@
1
+ Testing some more functions here...
2
+
3
+ .func just_do_it
4
+ item = param
5
+ # Do "something" with the parameter...
6
+ return "" # parameter disappears!
7
+ .end
8
+
9
+ Here I am calling a function $$just_do_it:foobar with
10
+ a colon parameter...
11
+
12
+
13
+ Next let's *do* something with our parameter:
14
+
15
+ .func reverse
16
+ param.reverse # just reverse it
17
+ .end
18
+
19
+ I'll call these variants...
20
+
21
+ "Motel" spelled backwards is $$reverse:motel :)
22
+
23
+ "lamina" reversed is $$reverse:lamina
24
+
25
+ I can also use the $$reverse[bracket feature] here.
26
+
27
+ If I don't use a parameter for $$reverse - it gives
28
+ me an error. (Bug or feature??)
29
+
30
+ What if a function doesn't use parameters at all, but
31
+ we pass them? Hmm...
32
+
33
+ .func meditate
34
+ "succeed" # just replaces params with this verb
35
+ .end
36
+
37
+ Now we $$meditate:slowly and $$meditate some more
38
+ and finally we $$meditate[on various things] in life.
39
+
40
+ But can we $$meditate, when our beds are burning?
@@ -4,4 +4,6 @@ testing a simple import
4
4
 
5
5
  Now call a method:
6
6
  Hello, world.
7
+ <p>
8
+
7
9
  That's all.
@@ -1,7 +1,9 @@
1
1
  Here I am
2
2
  testing a simple import
3
- .mixin simple_import
3
+
4
+ .import simple_import
4
5
 
5
6
  Now call a method:
6
7
  .hello_world
8
+
7
9
  That's all.
@@ -0,0 +1,83 @@
1
+ # This file specifies which snapshots will/won't be run.
2
+
3
+ # Blank lines and comments are ignored.
4
+ # Other lines: name_of_snapshot and any comments here are ignored (no # needed)
5
+
6
+ # You can start by uncommenting one of these:
7
+ # Default INCLUDE all
8
+ # Default EXCLUDE all
9
+ # If you use neither, INCLUDE is the default (but explicit is better)
10
+
11
+ # If you include all, you can specify exclusions with an x:
12
+ # x my_test_name # this is a comment
13
+
14
+ # Likewise if you EXCLUDE all, you can specify inclusions with an i:
15
+ # i some_other_test # this is a comment
16
+
17
+ # The i and x (to include/exclude) must be the first token on
18
+ # the line (preceding the test name)
19
+
20
+ # Note that QUIT (on a line by itself) will stop processing the file
21
+
22
+
23
+ # Others (usually passing):
24
+
25
+ # import/include/mixin, others...
26
+
27
+ x error_no_such_inc # Output BEFORE error doesn't get passed through ("leading" output)
28
+ x error_no_such_copy # ^ Same behavior as error_no_such_inc
29
+ x error_no_such_mixin # ^ Same behavior as error_missing_end
30
+ simple_copy #
31
+ simple_import #
32
+ simple_include #
33
+ simple_mixin #
34
+ x import # "Leading" output doesn't get generated (same as error_no_such_inc)
35
+ import2 #
36
+
37
+
38
+ # raw input
39
+
40
+ single_raw_line #
41
+ raw_lines #
42
+ raw_text_block #
43
+ copy_is_raw #
44
+
45
+ # comments
46
+
47
+ block_comment #
48
+ comments_ignored_1 #
49
+
50
+ # variables and heredocs
51
+
52
+ predef_vars #
53
+ simple_vars #
54
+ more_complex_vars #
55
+ table_with_heredocs #
56
+
57
+ # testing def
58
+
59
+ def_method #
60
+
61
+ # intraline formatting
62
+
63
+ basic_formatting #
64
+
65
+ # Errors
66
+
67
+ error_line_num #
68
+ error_mismatched_end #
69
+ error_name_not_permitted #
70
+ x error_invalid_name # ^ Same behavior as error_no_such_inc
71
+ x error_missing_end # Output is duplicated somehow. Look for: puts @body or puts @main.body
72
+ x error_inc_line_num # Forgot what's wrong here
73
+
74
+ # functions
75
+
76
+ functions #
77
+ more_functions #
78
+
79
+ # More/misc...
80
+
81
+ example_alpha #
82
+ example_alpha2 #
83
+ hello_world #
File without changes
@@ -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
+ .import bookish
2
+
3
+ .simple_table
4
+ this :: that
5
+ foo :: bar
6
+ .end
7
+
File without changes
data/test/snapshots.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'minitest/autorun'
2
1
 
3
2
  require_relative '../lib/livetext'
4
3
 
@@ -43,6 +42,76 @@ class TestingLivetext < MiniTest::Test
43
42
  EXP_OUT, EXP_ERR = "expected-output.txt", "expected-error.txt"
44
43
  MATCH_OUT, MATCH_ERR = "match-output.txt", "match-error.txt"
45
44
 
45
+ TTY = File.open("/dev/tty","w")
46
+
47
+ def self.get_dir # FIXME - uh what? remove this??
48
+ cmdline = ARGV.first == "cmdline"
49
+ if cmdline
50
+ dir = "../"
51
+ Dir.chdir `livetext --path`.chomp.chomp
52
+ else
53
+ dir = ""
54
+ end
55
+ end
56
+
57
+ args = ARGV - ["cmdline"]
58
+ dir = self.get_dir
59
+ Data = "#{dir}test/snapshots"
60
+ Dir.chdir(Data)
61
+ TestDirs = Dir.entries(".").reject {|fname| ! File.directory?(fname) } - %w[. ..]
62
+
63
+ def self.filter
64
+ all = Dir.entries(".").reject {|fname| ! File.directory?(fname) } - %w[. ..]
65
+ @included, @excluded = all, []
66
+ @reasons = []
67
+ @iflag, @eflag = true, false # defaults to INCLUDE
68
+ control = File.new("subset.txt")
69
+ control.each_line do |raw_line|
70
+ line = raw_line.dup
71
+ line.sub!(/#.*/, "")
72
+ line.strip!
73
+ line.chomp!
74
+ lower = line.downcase
75
+ dejavu = false
76
+ case
77
+ when lower.empty?
78
+ # ignore
79
+ when lower == "default include all"
80
+ raise "Only one 'default' allowed" if dejavu
81
+ @iflag, @eflag = true, false # defaults to INCLUDE
82
+ dejavu = true
83
+ when lower == "default exclude all"
84
+ raise "Only one 'default' allowed" if dejavu
85
+ @included = []
86
+ @iflag, @eflag = false, true
87
+ dejavu = true
88
+ when lower == "quit"
89
+ break
90
+ when lower[0] == "i" && lower[1] == " "
91
+ TTY.puts "Warning: Can't include with 'i' when that is default" if @iflag
92
+ val = raw_line.split(" ", 2)[1]
93
+ @included << val unless val.nil? # add to @included
94
+ when lower[0] == "x" && lower[1] == " "
95
+ TTY.puts "Warning: Can't exclude with 'x' when that is default" if @eflag
96
+ val, why = raw_line.split(" ", 3).values_at(1, 2)
97
+ @excluded << val unless val.nil? # add to @excluded
98
+ @reasons << why.chomp
99
+ end
100
+ end
101
+ unless @excluded.empty?
102
+ puts "\nExcluded:\n "
103
+ @excluded.each.with_index do |name, num|
104
+ printf " %-20s %s\n", name, @reasons[num]
105
+ end
106
+ puts
107
+ end
108
+ @included - @excluded
109
+ end
110
+
111
+ def after_suites
112
+ puts "Woohoo!"
113
+ end
114
+
46
115
  def initialize(base, assertion = nil)
47
116
  @assertion = assertion
48
117
  @base = base
@@ -109,9 +178,6 @@ class TestingLivetext < MiniTest::Test
109
178
  system("rm -f #{ACTUAL_OUT} #{ACTUAL_ERR} *sdiff.txt")
110
179
  end
111
180
 
112
- def filter # TODO move subset/omit logic here??
113
- end
114
-
115
181
  def run
116
182
  @errors = false # oops, need to reset
117
183
  Dir.chdir(@base) do
@@ -124,48 +190,7 @@ class TestingLivetext < MiniTest::Test
124
190
  end
125
191
  end
126
192
 
127
- def self.get_dir # FIXME - uh what?
128
- cmdline = ARGV.first == "cmdline" # FIXME remove??
129
- if cmdline
130
- dir = "../"
131
- Dir.chdir `livetext --path`.chomp.chomp
132
- else
133
- dir = ""
134
- end
135
- end
136
-
137
- TTY = File.open("/dev/tty","w")
138
-
139
- args = ARGV - ["cmdline"]
140
-
141
- dir = self.get_dir
142
-
143
- Data = "#{dir}test/snapshots"
144
- Dir.chdir(Data)
145
-
146
- TestDirs = Dir.entries(".").reject {|fname| ! File.directory?(fname) } - %w[. ..]
147
-
148
- if args.empty?
149
- selected = File.readlines("subset.txt").map(&:chomp)
150
- omitfile = "OMIT.txt"
151
- omitted = File.readlines(omitfile).map(&:chomp)
152
- omitted.reject! {|line| line.start_with?("#") }
153
- omit_names = omitted.map {|line| line.split.first }
154
- STDERR.puts
155
- STDERR.puts " >>> Warning: Omitting #{omitted.size} snapshot tests:\n "
156
- indented = " "*7
157
- omitted.each do |line|
158
- STDERR.print indented
159
- name, info = line.split(" ", 2)
160
- STDERR.printf "%-20s %s\n", name, info
161
- end
162
- STDERR.puts
163
- wanted = selected.empty? ? TestDirs : selected
164
- Subset = wanted - omit_names
165
- else
166
- Subset = args
167
- end
168
-
193
+ Subset = Snapshot.filter
169
194
 
170
195
  Subset.each do |tdir|
171
196
  define_method("test_#{tdir}") do