cri 2.6.1 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,86 +1,101 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Cri::CoreExtTestCase < Cri::TestCase
4
-
5
- def formatter
6
- Cri::StringFormatter.new
7
- end
8
-
9
- def test_string_to_paragraphs
10
- original = "Lorem ipsum dolor sit amet,\nconsectetur adipisicing.\n\n" +
11
- "Sed do eiusmod\ntempor incididunt ut labore."
12
-
13
- expected = [ "Lorem ipsum dolor sit amet, consectetur adipisicing.",
14
- "Sed do eiusmod tempor incididunt ut labore." ]
15
-
16
- actual = formatter.to_paragraphs(original)
17
- assert_equal expected, actual
18
- end
19
-
20
- def test_string_wrap_and_indent_without_indent
21
- original = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, " +
22
- "sed do eiusmod tempor incididunt ut labore et dolore " +
23
- "magna aliqua."
24
-
25
- expected = "Lorem ipsum dolor sit amet, consectetur\n" +
26
- "adipisicing elit, sed do eiusmod tempor\n" +
27
- "incididunt ut labore et dolore magna\n" +
28
- "aliqua."
29
-
30
- actual = formatter.wrap_and_indent(original, 40, 0)
31
- assert_equal expected, actual
32
- end
33
-
34
- def test_string_wrap_and_indent_with_indent
35
- original = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, " +
36
- "sed do eiusmod tempor incididunt ut labore et dolore " +
37
- "magna aliqua."
38
-
39
- expected = " Lorem ipsum dolor sit amet,\n" +
40
- " consectetur adipisicing elit,\n" +
41
- " sed do eiusmod tempor\n" +
42
- " incididunt ut labore et dolore\n" +
43
- " magna aliqua."
44
-
45
- actual = formatter.wrap_and_indent(original, 36, 4)
46
- assert_equal expected, actual
47
- end
48
-
49
- def test_string_wrap_and_indent_with_large_indent
50
- original = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, " +
51
- "sed do eiusmod tempor incididunt ut labore et dolore " +
52
- "magna aliqua."
53
-
54
- expected = " Lorem ipsum\n" +
55
- " dolor sit\n" +
56
- " amet,\n" +
57
- " consectetur\n" +
58
- " adipisicing\n" +
59
- " elit, sed do\n" +
60
- " eiusmod\n" +
61
- " tempor\n" +
62
- " incididunt ut\n" +
63
- " labore et\n" +
64
- " dolore magna\n" +
65
- " aliqua."
66
-
67
- actual = formatter.wrap_and_indent(original, 44, 30)
68
- assert_equal expected, actual
3
+ module Cri
4
+ class CoreExtTestCase < Cri::TestCase
5
+ def formatter
6
+ Cri::StringFormatter.new
7
+ end
8
+
9
+ def test_string_to_paragraphs
10
+ original = "Lorem ipsum dolor sit amet,\nconsectetur adipisicing.\n\n" \
11
+ "Sed do eiusmod\ntempor incididunt ut labore."
12
+
13
+ expected = ['Lorem ipsum dolor sit amet, consectetur adipisicing.',
14
+ 'Sed do eiusmod tempor incididunt ut labore.']
15
+
16
+ actual = formatter.to_paragraphs(original)
17
+ assert_equal expected, actual
18
+ end
19
+
20
+ def test_string_wrap_and_indent_without_indent
21
+ original = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' \
22
+ 'sed do eiusmod tempor incididunt ut labore et dolore ' \
23
+ 'magna aliqua.'
24
+
25
+ expected = "Lorem ipsum dolor sit amet, consectetur\n" \
26
+ "adipisicing elit, sed do eiusmod tempor\n" \
27
+ "incididunt ut labore et dolore magna\n" \
28
+ 'aliqua.'
29
+
30
+ actual = formatter.wrap_and_indent(original, 40, 0)
31
+ assert_equal expected, actual
32
+ end
33
+
34
+ def test_string_wrap_and_indent_with_indent
35
+ original = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' \
36
+ 'sed do eiusmod tempor incididunt ut labore et dolore ' \
37
+ 'magna aliqua.'
38
+
39
+ expected = " Lorem ipsum dolor sit amet,\n" \
40
+ " consectetur adipisicing elit,\n" \
41
+ " sed do eiusmod tempor\n" \
42
+ " incididunt ut labore et dolore\n" \
43
+ ' magna aliqua.'
44
+
45
+ actual = formatter.wrap_and_indent(original, 36, 4)
46
+ assert_equal expected, actual
47
+ end
48
+
49
+ def test_string_wrap_and_indent_excluding_first_line
50
+ original = 'Lorem ipsum dolor sit amet, consectetur adipisicing ' \
51
+ 'elit, sed do eiusmod tempor incididunt ut labore et dolore ' \
52
+ 'magna aliqua.'
53
+
54
+ expected = "Lorem ipsum dolor sit amet,\n" \
55
+ " consectetur adipisicing elit,\n" \
56
+ " sed do eiusmod tempor\n" \
57
+ " incididunt ut labore et dolore\n" \
58
+ ' magna aliqua.'
59
+
60
+ actual = formatter.wrap_and_indent(original, 36, 4, true)
61
+ assert_equal expected, actual
62
+ end
63
+
64
+ def test_string_wrap_and_indent_with_large_indent
65
+ original = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' \
66
+ 'sed do eiusmod tempor incididunt ut labore et dolore ' \
67
+ 'magna aliqua.'
68
+
69
+ expected = " Lorem ipsum\n" \
70
+ " dolor sit\n" \
71
+ " amet,\n" \
72
+ " consectetur\n" \
73
+ " adipisicing\n" \
74
+ " elit, sed do\n" \
75
+ " eiusmod\n" \
76
+ " tempor\n" \
77
+ " incididunt ut\n" \
78
+ " labore et\n" \
79
+ " dolore magna\n" \
80
+ ' aliqua.'
81
+
82
+ actual = formatter.wrap_and_indent(original, 44, 30)
83
+ assert_equal expected, actual
84
+ end
85
+
86
+ def test_string_wrap_and_indent_with_multiple_lines
87
+ original = "Lorem ipsum dolor sit\namet, consectetur adipisicing elit, " \
88
+ "sed do\neiusmod tempor incididunt ut\nlabore et dolore " \
89
+ "magna\naliqua."
90
+
91
+ expected = " Lorem ipsum dolor sit amet,\n" \
92
+ " consectetur adipisicing elit,\n" \
93
+ " sed do eiusmod tempor\n" \
94
+ " incididunt ut labore et dolore\n" \
95
+ ' magna aliqua.'
96
+
97
+ actual = formatter.wrap_and_indent(original, 36, 4)
98
+ assert_equal expected, actual
99
+ end
69
100
  end
70
-
71
- def test_string_wrap_and_indent_with_multiple_lines
72
- original = "Lorem ipsum dolor sit\namet, consectetur adipisicing elit, " +
73
- "sed do\neiusmod tempor incididunt ut\nlabore et dolore " +
74
- "magna\naliqua."
75
-
76
- expected = " Lorem ipsum dolor sit amet,\n" +
77
- " consectetur adipisicing elit,\n" +
78
- " sed do eiusmod tempor\n" +
79
- " incididunt ut labore et dolore\n" +
80
- " magna aliqua."
81
-
82
- actual = formatter.wrap_and_indent(original, 36, 4)
83
- assert_equal expected, actual
84
- end
85
-
86
101
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cri
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-27 00:00:00.000000000 Z
11
+ date: 2015-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubyforge_project:
104
- rubygems_version: 2.2.2
104
+ rubygems_version: 2.4.6
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: a library for building easy-to-use commandline tools