livetext 0.9.23 → 0.9.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.lt3 +6 -6
- data/bin/livetext +57 -40
- data/imports/bookish.rb +81 -81
- data/imports/calibre.rb +3 -3
- data/imports/livemagick.rb +17 -17
- data/imports/markdown.rb +10 -10
- data/imports/pyggish.rb +13 -13
- data/imports/tutorial.rb +15 -15
- data/lib/cmdargs.rb +7 -4
- data/lib/{errors.rb → livetext/errors.rb} +4 -3
- data/lib/{formatline.rb → livetext/formatline.rb} +119 -18
- data/lib/livetext/funcall.rb +168 -0
- data/lib/{functions.rb → livetext/functions.rb} +0 -2
- data/lib/{global_helpers.rb → livetext/global_helpers.rb} +6 -3
- data/lib/{handler → livetext/handler}/import.rb +5 -9
- data/lib/livetext/handler/mixin.rb +33 -0
- data/lib/{handler.rb → livetext/handler.rb} +1 -1
- data/lib/{helpers.rb → livetext/helpers.rb} +78 -66
- data/lib/{html.rb → livetext/html.rb} +2 -3
- data/lib/livetext/lineparser.rb +441 -0
- data/lib/livetext/more.rb +158 -0
- data/lib/{parser → livetext/parser}/general.rb +0 -0
- data/lib/{parser → livetext/parser}/set.rb +0 -0
- data/lib/{parser → livetext/parser}/string.rb +0 -0
- data/lib/{parser.rb → livetext/parser.rb} +0 -3
- data/lib/{parsing.rb → livetext/parsing.rb} +0 -2
- data/lib/livetext/paths.rb +13 -0
- data/lib/{processor.rb → livetext/processor.rb} +18 -8
- data/lib/livetext/reopen.rb +12 -0
- data/lib/livetext/skeleton.rb +22 -0
- data/lib/{standard.rb → livetext/standard.rb} +150 -127
- data/lib/livetext/userapi.rb +170 -0
- data/lib/livetext/version.rb +6 -0
- data/lib/livetext.rb +14 -152
- data/plugin/bookish.rb +82 -81
- data/plugin/calibre.rb +3 -3
- data/plugin/livemagick.rb +17 -17
- data/plugin/markdown.rb +10 -10
- data/plugin/pyggish.rb +118 -118
- data/plugin/tutorial.rb +15 -15
- data/test/all.rb +6 -0
- data/test/snapshots/{error_inc_line_num → basic_formatting}/actual-error.txt +0 -0
- data/test/snapshots/basic_formatting/actual-output.txt +13 -0
- data/test/snapshots/basic_formatting/err-sdiff.txt +1 -0
- data/test/snapshots/basic_formatting/out-sdiff.txt +14 -0
- data/test/snapshots/def_method/expected-output.txt +2 -0
- data/test/snapshots/def_method/source.lt3 +4 -2
- data/test/snapshots/error_inc_line_num/{OUT → README.txt} +11 -8
- data/test/snapshots/error_inc_line_num/expected-output.txt +0 -6
- data/test/snapshots/error_inc_line_num/match-error.txt +1 -1
- data/test/snapshots/error_invalid_name/foo +5 -0
- data/test/snapshots/error_line_num/match-error.txt +1 -1
- data/test/snapshots/error_missing_end/expected-output.txt +0 -1
- data/test/snapshots/error_name_not_permitted/expected-output.txt +4 -0
- data/test/snapshots/error_name_not_permitted/match-error.txt +1 -1
- data/test/snapshots/error_no_such_copy/expected-output.txt +1 -0
- data/test/snapshots/error_no_such_mixin/expected-output.txt +1 -0
- data/test/snapshots/error_no_such_mixin/match-error.txt +1 -1
- data/test/snapshots/error_no_such_mixin/source.lt3 +1 -1
- data/test/snapshots/example_alpha/source.lt3 +2 -2
- data/test/snapshots/example_alpha2/expected-output.txt +0 -2
- data/test/snapshots/example_alpha2/source.lt3 +5 -4
- data/test/snapshots/import/expected-output.txt +2 -1
- data/test/snapshots/import/match-error.txt +1 -1
- data/test/snapshots/import/simple_import.rb +1 -1
- data/test/snapshots/import2/simple_import.rb +1 -1
- data/test/snapshots/import_bookish/expected-output.txt +4 -4
- data/test/snapshots/{error_invalid_name/actual-output.txt → more_functions/actual-error.txt} +0 -0
- data/test/snapshots/more_functions/actual-output.txt +37 -0
- data/test/snapshots/more_functions/err-sdiff.txt +1 -0
- data/test/snapshots/more_functions/expected-output.txt +1 -1
- data/test/snapshots/more_functions/out-sdiff.txt +38 -0
- data/test/snapshots/more_functions/source.lt3 +1 -1
- data/test/snapshots/raw_lines/expected-output.txt +0 -2
- data/test/snapshots/simple_import/simple_import.rb +1 -1
- data/test/snapshots/simple_mixin/simple_mixin.rb +1 -1
- data/test/snapshots/{error_missing_end/actual-output.txt → simple_vars/actual-error.txt} +0 -0
- data/test/snapshots/simple_vars/actual-output.txt +6 -0
- data/test/snapshots/simple_vars/err-sdiff.txt +1 -0
- data/test/snapshots/simple_vars/out-sdiff.txt +7 -0
- data/test/snapshots/single_raw_line/expected-output.txt +0 -2
- data/test/snapshots/subset.txt +9 -7
- data/test/snapshots/{error_no_such_copy/actual-output.txt → var_into_func/actual-error.txt} +0 -0
- data/test/snapshots/var_into_func/actual-output.txt +16 -0
- data/test/snapshots/var_into_func/err-sdiff.txt +1 -0
- data/test/snapshots/{error_no_such_inc/actual-output.txt → var_into_func/expected-error.txt} +0 -0
- data/test/snapshots/var_into_func/expected-output.txt +16 -0
- data/test/snapshots/var_into_func/out-sdiff.txt +17 -0
- data/test/snapshots/var_into_func/source.lt3 +16 -0
- data/test/snapshots.rb +16 -7
- data/test/unit/all.rb +3 -1
- data/test/unit/formatline.rb +145 -276
- data/test/unit/html.rb +1 -2
- data/test/unit/lineparser.rb +650 -0
- data/test/unit/parser/set.rb +13 -12
- data/test/unit/standard.rb +0 -1
- data/test/unit/tokenizer.rb +534 -0
- metadata +49 -39
- data/lib/funcall.rb +0 -93
- data/lib/parser/file.rb +0 -6
- data/lib/parser/mixin.rb +0 -34
- data/lib/userapi.rb +0 -164
- data/test/snapshots/error_inc_line_num/actual-output.txt +0 -17
- data/test/snapshots/error_invalid_name/actual-error.txt +0 -10
- data/test/snapshots/error_invalid_name/out-sdiff.txt +0 -6
- data/test/snapshots/error_missing_end/actual-error.txt +0 -10
- data/test/snapshots/error_missing_end/out-sdiff.txt +0 -6
- data/test/snapshots/error_no_such_copy/actual-error.txt +0 -10
- data/test/snapshots/error_no_such_copy/out-sdiff.txt +0 -5
- data/test/snapshots/error_no_such_inc/actual-error.txt +0 -10
- data/test/snapshots/error_no_such_inc/out-sdiff.txt +0 -6
- data/test/snapshots/error_no_such_mixin/actual-error.txt +0 -13
- data/test/snapshots/error_no_such_mixin/actual-output.txt +0 -0
- data/test/snapshots/error_no_such_mixin/out-sdiff.txt +0 -6
@@ -0,0 +1,38 @@
|
|
1
|
+
ACTUAL | EXPECTED
|
2
|
+
Testing some more functions here... Testing some more functions here...
|
3
|
+
<p> <p>
|
4
|
+
|
5
|
+
Here I am calling a function with Here I am calling a function with
|
6
|
+
a colon parameter... a colon parameter...
|
7
|
+
<p> <p>
|
8
|
+
|
9
|
+
<p> <p>
|
10
|
+
|
11
|
+
Next let's <b>do</b>*something with our parameter: | Next let's <b>do</b> something with our parameter:
|
12
|
+
<p> <p>
|
13
|
+
|
14
|
+
I'll call these variants... I'll call these variants...
|
15
|
+
<p> <p>
|
16
|
+
|
17
|
+
"Motel" spelled backwards is letom :) "Motel" spelled backwards is letom :)
|
18
|
+
<p> <p>
|
19
|
+
|
20
|
+
"lamina" reversed is animal "lamina" reversed is animal
|
21
|
+
<p> <p>
|
22
|
+
|
23
|
+
I can also use the erutaef tekcarb here. I can also use the erutaef tekcarb here.
|
24
|
+
<p> <p>
|
25
|
+
|
26
|
+
If I don't use a parameter for [Error evaluating $$reverse( If I don't use a parameter for [Error evaluating $$reverse(
|
27
|
+
me an error. (Bug or feature??) me an error. (Bug or feature??)
|
28
|
+
<p> <p>
|
29
|
+
|
30
|
+
What if a function doesn't use parameters at all, but What if a function doesn't use parameters at all, but
|
31
|
+
we pass them? Hmm... we pass them? Hmm...
|
32
|
+
<p> <p>
|
33
|
+
|
34
|
+
Now we succeed and succeed some more Now we succeed and succeed some more
|
35
|
+
and finally we succeed in life. and finally we succeed in life.
|
36
|
+
<p> <p>
|
37
|
+
|
38
|
+
But can we succeed, when our beds are burning? But can we succeed, when our beds are burning?
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
ACTUAL | EXPECTED
|
@@ -0,0 +1,7 @@
|
|
1
|
+
ACTUAL | EXPECTED
|
2
|
+
Just Just
|
3
|
+
some text. some text.
|
4
|
+
Hi, there. Hi, there.
|
5
|
+
GulliverFoyle is my name, and Terra is my nation. GulliverFoyle is my name, and Terra is my nation.
|
6
|
+
I'm GulliverFoyle, from Terra | I'm GulliverFoyle, from Terra.
|
7
|
+
That's all. That's all.
|
data/test/snapshots/subset.txt
CHANGED
@@ -24,14 +24,14 @@ h This file specifies which snapshots will/won't be run.
|
|
24
24
|
|
25
25
|
# import/include/mixin, others...
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
error_no_such_inc # Output BEFORE error doesn't get passed through ("leading" output)
|
28
|
+
error_no_such_copy # ^ Same behavior as error_no_such_inc
|
29
|
+
error_no_such_mixin # ^ Same behavior as error_missing_end
|
30
30
|
simple_copy #
|
31
31
|
simple_import #
|
32
32
|
simple_include #
|
33
33
|
simple_mixin #
|
34
|
-
|
34
|
+
import # "Leading" output doesn't get generated (same as error_no_such_inc)
|
35
35
|
import2 #
|
36
36
|
mixin_bookish #
|
37
37
|
import_bookish #
|
@@ -62,15 +62,17 @@ x import # "Leading" output doesn't get generated (same as er
|
|
62
62
|
# intraline formatting
|
63
63
|
|
64
64
|
basic_formatting #
|
65
|
+
test_formatting_34 #
|
66
|
+
test_formatting_35 #
|
65
67
|
|
66
68
|
# Errors
|
67
69
|
|
68
70
|
error_line_num #
|
69
71
|
error_mismatched_end #
|
70
72
|
error_name_not_permitted #
|
71
|
-
|
72
|
-
|
73
|
-
|
73
|
+
error_invalid_name # ^ Same behavior as error_no_such_inc
|
74
|
+
error_missing_end # Output is duplicated somehow. Look for: puts @body or puts @main.body
|
75
|
+
error_inc_line_num # Forgot what's wrong here
|
74
76
|
|
75
77
|
# functions
|
76
78
|
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
ACTUAL | EXPECTED
|
data/test/snapshots/{error_no_such_inc/actual-output.txt → var_into_func/expected-error.txt}
RENAMED
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
ACTUAL | EXPECTED
|
2
|
+
<p> <p>
|
3
|
+
|
4
|
+
Testing STILL more functions here... Testing STILL more functions here...
|
5
|
+
<p> <p>
|
6
|
+
|
7
|
+
<p> <p>
|
8
|
+
|
9
|
+
Now... let's try passing a variable to a function. Will thi Now... let's try passing a variable to a function. Will thi
|
10
|
+
<p> <p>
|
11
|
+
|
12
|
+
Variable \regal is regal, which reversed is ahpla$ | Variable $alpha is regal, which reversed is lager
|
13
|
+
<p> <p>
|
14
|
+
|
15
|
+
That's all. That's all.
|
16
|
+
<p> <p>
|
17
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
Testing STILL more functions here...
|
3
|
+
|
4
|
+
|
5
|
+
.func reverse
|
6
|
+
param.reverse # just reverse it
|
7
|
+
.end
|
8
|
+
|
9
|
+
Now... let's try passing a variable to a function. Will this work??
|
10
|
+
|
11
|
+
.set alpha = regal
|
12
|
+
|
13
|
+
Variable \$alpha is $alpha, which reversed is $$reverse:$alpha
|
14
|
+
|
15
|
+
That's all.
|
16
|
+
|
data/test/snapshots.rb
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
require 'simplecov' # These two lines must go first
|
2
|
+
SimpleCov.use_merging(true)
|
3
|
+
SimpleCov.start do
|
4
|
+
puts "SimpleCov: Snapshots"
|
5
|
+
add_filter "/test/"
|
6
|
+
enable_coverage :branch
|
7
|
+
primary_coverage :branch
|
8
|
+
end
|
9
|
+
|
1
10
|
require 'minitest/autorun'
|
2
11
|
|
3
12
|
require_relative '../lib/livetext'
|
@@ -7,10 +16,10 @@ Snapshots...
|
|
7
16
|
|
8
17
|
NOTE that the external_files method has been replaced by the Snapshot class.
|
9
18
|
|
10
|
-
You can add any ordinary test method above. But so far, most of these tests simply
|
19
|
+
You can add any ordinary test method above. But so far, most of these tests simply
|
11
20
|
call Snapshot.new
|
12
21
|
|
13
|
-
It works this way:
|
22
|
+
It works this way:
|
14
23
|
- If the test (caller) method is test_my_silly_feature, then we will
|
15
24
|
look for a directory called snapshots/my_silly_feature
|
16
25
|
- In here, there must be a source.lt3
|
@@ -20,12 +29,12 @@ It works this way:
|
|
20
29
|
- The expected-* files are "literal" data
|
21
30
|
* compared byte-for-byte
|
22
31
|
* watch spaces and bad regexes, etc. #duh
|
23
|
-
* each of these files corresponds to a single assertion
|
24
|
-
- A match-* file has two entries per line:
|
32
|
+
* each of these files corresponds to a single assertion
|
33
|
+
- A match-* file has two entries per line:
|
25
34
|
* a ONE-BASED line number (in actual-* file)
|
26
35
|
* a String OR a Regexp (to match against that line)
|
27
36
|
* If there is nonsense here, it currently isn't caught
|
28
|
-
* each of these files MAY correspond to many assertions
|
37
|
+
* each of these files MAY correspond to many assertions
|
29
38
|
- We run livetext on the source and compare actual vs expected (stdout, stderr)
|
30
39
|
- The error output gets checked first (expected or match), THEN standard output
|
31
40
|
- Of course, both must compare correctly for the test to pass
|
@@ -62,7 +71,7 @@ class TestingLivetext < MiniTest::Test
|
|
62
71
|
TestDirs = Dir.entries(".").reject {|fname| ! File.directory?(fname) } - %w[. ..]
|
63
72
|
|
64
73
|
Specified = []
|
65
|
-
Args.each do |name|
|
74
|
+
Args.each do |name|
|
66
75
|
which = TestDirs.select {|tdir| Regexp.new(name) =~ tdir }
|
67
76
|
which.each {|item| Specified << item }
|
68
77
|
end
|
@@ -112,7 +121,7 @@ class TestingLivetext < MiniTest::Test
|
|
112
121
|
end
|
113
122
|
unless @excluded.empty?
|
114
123
|
puts "\nExcluded:\n "
|
115
|
-
@excluded.each.with_index do |name, num|
|
124
|
+
@excluded.each.with_index do |name, num|
|
116
125
|
printf " %-20s %s\n", name, @reasons[num]
|
117
126
|
end
|
118
127
|
puts
|