riel 1.1.10 → 1.1.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,13 @@
1
1
  #!/usr/bin/ruby -w
2
2
  # -*- ruby -*-
3
3
 
4
- require 'rubyunit'
4
+ require 'test/unit'
5
5
  require 'riel/text'
6
6
 
7
- class TextTestCase < RUNIT::TestCase
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
- assert_equals "#{escape_sequence}#{str}\e[0m", input
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
- do_ansi_test(str, str.none, 0)
20
- do_ansi_test(str, str.bold, 1)
21
- do_ansi_test(str, str.underline, 4)
22
- do_ansi_test(str, str.underscore, 4)
23
- do_ansi_test(str, str.blink, 5) # every geocities site circa 1998
24
- do_ansi_test(str, str.negative, 7)
25
- do_ansi_test(str, str.concealed, 8)
26
- do_ansi_test(str, str.black, 30)
27
- do_ansi_test(str, str.red, 31)
28
- do_ansi_test(str, str.green, 32)
29
- do_ansi_test(str, str.yellow, 33)
30
- do_ansi_test(str, str.blue, 34)
31
- do_ansi_test(str, str.magenta, 35)
32
- do_ansi_test(str, str.cyan, 36)
33
- do_ansi_test(str, str.white, 37)
34
- do_ansi_test(str, str.on_black, 40)
35
- do_ansi_test(str, str.on_red, 41)
36
- do_ansi_test(str, str.on_green, 42)
37
- do_ansi_test(str, str.on_yellow, 43)
38
- do_ansi_test(str, str.on_blue, 44)
39
- do_ansi_test(str, str.on_magenta, 45)
40
- do_ansi_test(str, str.on_cyan, 46)
41
- do_ansi_test(str, str.on_white, 47)
42
- do_ansi_test(str, str.none_on_white, 0, 47)
43
- do_ansi_test(str, str.none_on_black, 0, 40)
44
- do_ansi_test(str, str.none_on_blue, 0, 44)
45
- do_ansi_test(str, str.red_on_white, 31, 47)
46
- do_ansi_test(str, str.bold_red_on_white, 1, 31, 47)
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 do_html_test(expected, input)
51
- assert_equals expected, input
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
- do_html_test(str, str.none)
60
- do_html_test("<b>" + str + "</b>", str.bold)
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
- do_html_test("<u>" + str + "</u>", input)
61
+ run_html_test "<u>" + str + "</u>", input
64
62
  end
65
63
 
66
- do_html_test("<blink>" + str + "</blink>", str.blink)
67
- do_html_test("<span style=\"color: white; background-color: black\">" + str + "</span>", str.negative)
68
- do_html_test("<!-- " + str + " -->", str.concealed)
69
- do_html_test("<span style=\"color: black\">" + str + "</span>", str.black)
70
- do_html_test("<span style=\"color: red\">" + str + "</span>", str.red)
71
- do_html_test("<span style=\"color: green\">" + str + "</span>", str.green)
72
- do_html_test("<span style=\"color: yellow\">" + str + "</span>", str.yellow)
73
- do_html_test("<span style=\"color: blue\">" + str + "</span>", str.blue)
74
- do_html_test("<span style=\"color: #FF00FF\">" + str + "</span>", str.magenta)
75
- do_html_test("<span style=\"color: #00FFFF\">" + str + "</span>", str.cyan)
76
- do_html_test("<span style=\"color: white\">" + str + "</span>", str.white)
77
- do_html_test("<span style=\"background-color: black\">" + str + "</span>", str.on_black)
78
- do_html_test("<span style=\"background-color: red\">" + str + "</span>", str.on_red)
79
- do_html_test("<span style=\"background-color: green\">" + str + "</span>", str.on_green)
80
- do_html_test("<span style=\"background-color: yellow\">" + str + "</span>", str.on_yellow)
81
- do_html_test("<span style=\"background-color: blue\">" + str + "</span>", str.on_blue)
82
- do_html_test("<span style=\"background-color: #FF00FF\">" + str + "</span>", str.on_magenta)
83
- do_html_test("<span style=\"background-color: #00FFFF\">" + str + "</span>", str.on_cyan)
84
- do_html_test("<span style=\"background-color: white\">" + str + "</span>", str.on_white)
85
- do_html_test("<span style=\"background-color: white\">" + str + "</span>", str.none_on_white)
86
- do_html_test("<span style=\"background-color: black\">" + str + "</span>", str.none_on_black)
87
- do_html_test("<span style=\"background-color: blue\">" + str + "</span>", str.none_on_blue)
88
- do_html_test("<span style=\"color: red\">" + "<span style=\"background-color: white\">" + str + "</span>" + "</span>", str.red_on_white)
89
- do_html_test("<b><span style=\"color: red\">" + "<span style=\"background-color: white\">" + str + "</span>" + "</span></b>", str.bold_red_on_white)
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("noisicerp", "precision".reverse)
96
+ assert_equal "noisicerp", "precision".reverse
100
97
  end
101
-
102
98
  end
@@ -1,15 +1,14 @@
1
1
  #!/usr/bin/ruby -w
2
2
  # -*- ruby -*-
3
3
 
4
- require 'rubyunit'
4
+ require 'test/unit'
5
5
  require 'riel/timer'
6
6
  require 'stringio'
7
7
 
8
- class TimerTestCase < RUNIT::TestCase
9
-
8
+ class TimerTestCase < Test::Unit::TestCase
10
9
  TIMER_STRING = "sleep for a second"
11
10
 
12
- def do_assertions(io)
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 = StringIO.new
23
+ $stdout = StringIO.new
25
24
  timer = Timer.new(TIMER_STRING) do
26
- sleep(0.1)
25
+ sleep 0.1
27
26
  end
28
27
 
29
- do_assertions($stdout)
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(0.1)
36
+ sleep 0.1
38
37
  end
39
38
 
40
- do_assertions(stringio)
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: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 10
10
- version: 1.1.10
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-01 00:00:00 -04:00
18
+ date: 2012-11-22 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies: []
21
21