riel 1.1.10 → 1.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/riel/dir.rb +9 -7
- data/lib/riel/io.rb +1 -1
- data/lib/riel/optproc.rb +1 -1
- data/lib/riel/pathname.rb +1 -1
- data/lib/riel/text.rb +3 -0
- data/lib/riel.rb +1 -1
- data/test/riel/array_test.rb +2 -2
- data/test/riel/command_test.rb +5 -7
- data/test/riel/date_test.rb +3 -5
- data/test/riel/dir_test.rb +7 -8
- data/test/riel/enumerable_test.rb +10 -13
- data/test/riel/env_test.rb +14 -18
- data/test/riel/file_test.rb +23 -26
- data/test/riel/filetype_test.rb +15 -18
- data/test/riel/hash_test.rb +3 -5
- data/test/riel/integer_test.rb +2 -2
- data/test/riel/io_test.rb +3 -3
- data/test/riel/log_stack_test.rb +5 -31
- data/test/riel/log_test.rb +23 -41
- data/test/riel/matchdata_test.rb +3 -6
- data/test/riel/optproc_test.rb +27 -29
- data/test/riel/pathname_test.rb +7 -10
- data/test/riel/rcfile_test.rb +5 -8
- data/test/riel/regexp_test.rb +11 -13
- data/test/riel/setdiff_test.rb +13 -16
- data/test/riel/size_converter_test.rb +10 -12
- data/test/riel/string_test.rb +32 -34
- data/test/riel/tempfile_test.rb +4 -8
- data/test/riel/text_test.rb +62 -66
- data/test/riel/timer_test.rb +8 -10
- metadata +4 -4
data/test/riel/text_test.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
|
-
require '
|
4
|
+
require 'test/unit'
|
5
5
|
require 'riel/text'
|
6
6
|
|
7
|
-
class TextTestCase <
|
8
|
-
|
9
|
-
def do_ansi_test(str, input, *chars)
|
7
|
+
class TextTestCase < Test::Unit::TestCase
|
8
|
+
def run_ansi_test str, input, *chars
|
10
9
|
escape_sequence = chars.collect { |ch| "\e[#{ch}m" }.join("")
|
11
|
-
|
10
|
+
assert_equal "#{escape_sequence}#{str}\e[0m", input
|
12
11
|
end
|
13
12
|
|
14
13
|
def test_ansi_highlight
|
@@ -16,39 +15,38 @@ class TextTestCase < RUNIT::TestCase
|
|
16
15
|
|
17
16
|
str = "precision"
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
18
|
+
run_ansi_test str, str.none, 0
|
19
|
+
run_ansi_test str, str.bold, 1
|
20
|
+
run_ansi_test str, str.underline, 4
|
21
|
+
run_ansi_test str, str.underscore, 4
|
22
|
+
run_ansi_test str, str.blink, 5 # every geocities site circa 1998
|
23
|
+
run_ansi_test str, str.negative, 7
|
24
|
+
run_ansi_test str, str.concealed, 8
|
25
|
+
run_ansi_test str, str.black, 30
|
26
|
+
run_ansi_test str, str.red, 31
|
27
|
+
run_ansi_test str, str.green, 32
|
28
|
+
run_ansi_test str, str.yellow, 33
|
29
|
+
run_ansi_test str, str.blue, 34
|
30
|
+
run_ansi_test str, str.magenta, 35
|
31
|
+
run_ansi_test str, str.cyan, 36
|
32
|
+
run_ansi_test str, str.white, 37
|
33
|
+
run_ansi_test str, str.on_black, 40
|
34
|
+
run_ansi_test str, str.on_red, 41
|
35
|
+
run_ansi_test str, str.on_green, 42
|
36
|
+
run_ansi_test str, str.on_yellow, 43
|
37
|
+
run_ansi_test str, str.on_blue, 44
|
38
|
+
run_ansi_test str, str.on_magenta, 45
|
39
|
+
run_ansi_test str, str.on_cyan, 46
|
40
|
+
run_ansi_test str, str.on_white, 47
|
41
|
+
run_ansi_test str, str.none_on_white, 0, 47
|
42
|
+
run_ansi_test str, str.none_on_black, 0, 40
|
43
|
+
run_ansi_test str, str.none_on_blue, 0, 44
|
44
|
+
run_ansi_test str, str.red_on_white, 31, 47
|
45
|
+
run_ansi_test str, str.bold_red_on_white, 1, 31, 47
|
48
46
|
end
|
49
47
|
|
50
|
-
def
|
51
|
-
|
48
|
+
def run_html_test expected, input
|
49
|
+
assert_equal expected, input
|
52
50
|
end
|
53
51
|
|
54
52
|
def test_html_highlight
|
@@ -56,38 +54,37 @@ class TextTestCase < RUNIT::TestCase
|
|
56
54
|
|
57
55
|
str = "precision"
|
58
56
|
|
59
|
-
|
60
|
-
|
57
|
+
run_html_test str, str.none
|
58
|
+
run_html_test "<b>" + str + "</b>", str.bold
|
61
59
|
|
62
60
|
[ str.underline, str.underscore ].each do |input|
|
63
|
-
|
61
|
+
run_html_test "<u>" + str + "</u>", input
|
64
62
|
end
|
65
63
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
64
|
+
run_html_test "<blink>" + str + "</blink>", str.blink
|
65
|
+
run_html_test "<span style=\"color: white; background-color: black\">" + str + "</span>", str.negative
|
66
|
+
run_html_test "<!-- " + str + " -->", str.concealed
|
67
|
+
run_html_test "<span style=\"color: black\">" + str + "</span>", str.black
|
68
|
+
run_html_test "<span style=\"color: red\">" + str + "</span>", str.red
|
69
|
+
run_html_test "<span style=\"color: green\">" + str + "</span>", str.green
|
70
|
+
run_html_test "<span style=\"color: yellow\">" + str + "</span>", str.yellow
|
71
|
+
run_html_test "<span style=\"color: blue\">" + str + "</span>", str.blue
|
72
|
+
run_html_test "<span style=\"color: #FF00FF\">" + str + "</span>", str.magenta
|
73
|
+
run_html_test "<span style=\"color: #00FFFF\">" + str + "</span>", str.cyan
|
74
|
+
run_html_test "<span style=\"color: white\">" + str + "</span>", str.white
|
75
|
+
run_html_test "<span style=\"background-color: black\">" + str + "</span>", str.on_black
|
76
|
+
run_html_test "<span style=\"background-color: red\">" + str + "</span>", str.on_red
|
77
|
+
run_html_test "<span style=\"background-color: green\">" + str + "</span>", str.on_green
|
78
|
+
run_html_test "<span style=\"background-color: yellow\">" + str + "</span>", str.on_yellow
|
79
|
+
run_html_test "<span style=\"background-color: blue\">" + str + "</span>", str.on_blue
|
80
|
+
run_html_test "<span style=\"background-color: #FF00FF\">" + str + "</span>", str.on_magenta
|
81
|
+
run_html_test "<span style=\"background-color: #00FFFF\">" + str + "</span>", str.on_cyan
|
82
|
+
run_html_test "<span style=\"background-color: white\">" + str + "</span>", str.on_white
|
83
|
+
run_html_test "<span style=\"background-color: white\">" + str + "</span>", str.none_on_white
|
84
|
+
run_html_test "<span style=\"background-color: black\">" + str + "</span>", str.none_on_black
|
85
|
+
run_html_test "<span style=\"background-color: blue\">" + str + "</span>", str.none_on_blue
|
86
|
+
run_html_test "<span style=\"color: red\">" + "<span style=\"background-color: white\">" + str + "</span>" + "</span>", str.red_on_white
|
87
|
+
run_html_test "<b><span style=\"color: red\">" + "<span style=\"background-color: white\">" + str + "</span>" + "</span></b>", str.bold_red_on_white
|
91
88
|
end
|
92
89
|
|
93
90
|
def test_string_reverse
|
@@ -96,7 +93,6 @@ class TextTestCase < RUNIT::TestCase
|
|
96
93
|
str = "precision"
|
97
94
|
|
98
95
|
# this tests that string.reverse does not mean ANSI reverse
|
99
|
-
assert_equal
|
96
|
+
assert_equal "noisicerp", "precision".reverse
|
100
97
|
end
|
101
|
-
|
102
98
|
end
|
data/test/riel/timer_test.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
|
-
require '
|
4
|
+
require 'test/unit'
|
5
5
|
require 'riel/timer'
|
6
6
|
require 'stringio'
|
7
7
|
|
8
|
-
class TimerTestCase <
|
9
|
-
|
8
|
+
class TimerTestCase < Test::Unit::TestCase
|
10
9
|
TIMER_STRING = "sleep for a second"
|
11
10
|
|
12
|
-
def
|
11
|
+
def run_assertions io
|
13
12
|
assert_not_nil io
|
14
13
|
str = io.string
|
15
14
|
assert_not_nil str
|
@@ -21,12 +20,12 @@ class TimerTestCase < RUNIT::TestCase
|
|
21
20
|
|
22
21
|
def test_to_stdout
|
23
22
|
orig_out = $stdout
|
24
|
-
$stdout
|
23
|
+
$stdout = StringIO.new
|
25
24
|
timer = Timer.new(TIMER_STRING) do
|
26
|
-
sleep
|
25
|
+
sleep 0.1
|
27
26
|
end
|
28
27
|
|
29
|
-
|
28
|
+
run_assertions $stdout
|
30
29
|
|
31
30
|
$stdout = orig_out
|
32
31
|
end
|
@@ -34,10 +33,9 @@ class TimerTestCase < RUNIT::TestCase
|
|
34
33
|
def test_to_io
|
35
34
|
stringio = StringIO.new
|
36
35
|
timer = Timer.new("sleep for a second", :io => stringio) do
|
37
|
-
sleep
|
36
|
+
sleep 0.1
|
38
37
|
end
|
39
38
|
|
40
|
-
|
39
|
+
run_assertions stringio
|
41
40
|
end
|
42
|
-
|
43
41
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 11
|
10
|
+
version: 1.1.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeff Pace
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-11-
|
18
|
+
date: 2012-11-22 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|