xqsr3 0.38.2 → 0.39.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -6
  3. data/examples/count_word_frequencies.md +12 -12
  4. data/examples/count_word_frequencies.rb +4 -4
  5. data/lib/xqsr3/array_utilities/join_with_or.rb +47 -47
  6. data/lib/xqsr3/array_utilities.rb +2 -2
  7. data/lib/xqsr3/command_line_utilities/map_option_string.rb +60 -60
  8. data/lib/xqsr3/command_line_utilities.rb +2 -2
  9. data/lib/xqsr3/containers/frequency_map.rb +399 -399
  10. data/lib/xqsr3/containers/multi_map.rb +448 -448
  11. data/lib/xqsr3/containers.rb +3 -3
  12. data/lib/xqsr3/conversion/bool_parser.rb +51 -51
  13. data/lib/xqsr3/conversion/integer_parser.rb +87 -87
  14. data/lib/xqsr3/conversion.rb +3 -3
  15. data/lib/xqsr3/diagnostics/exception_utilities.rb +145 -145
  16. data/lib/xqsr3/diagnostics/exceptions/with_cause.rb +90 -90
  17. data/lib/xqsr3/diagnostics/inspect_builder.rb +80 -80
  18. data/lib/xqsr3/diagnostics.rb +3 -3
  19. data/lib/xqsr3/doc_.rb +130 -130
  20. data/lib/xqsr3/extensions/array/join_with_or.rb +9 -9
  21. data/lib/xqsr3/extensions/enumerable/collect_with_index.rb +12 -12
  22. data/lib/xqsr3/extensions/enumerable/detect_map.rb +35 -35
  23. data/lib/xqsr3/extensions/enumerable/unique.rb +29 -28
  24. data/lib/xqsr3/extensions/hash/deep_transform.rb +1 -1
  25. data/lib/xqsr3/extensions/hash/except.rb +16 -16
  26. data/lib/xqsr3/extensions/hash/has_match.rb +10 -10
  27. data/lib/xqsr3/extensions/hash/match.rb +10 -10
  28. data/lib/xqsr3/extensions/hash/slice.rb +11 -11
  29. data/lib/xqsr3/extensions/hash.rb +1 -1
  30. data/lib/xqsr3/extensions/integer/to_s_grp.rb +118 -0
  31. data/lib/xqsr3/extensions/integer.rb +3 -0
  32. data/lib/xqsr3/extensions/io/writelines.rb +28 -28
  33. data/lib/xqsr3/extensions/kernel/integer.rb +20 -20
  34. data/lib/xqsr3/extensions/kernel/raise_with_options.rb +8 -8
  35. data/lib/xqsr3/extensions/kernel.rb +1 -0
  36. data/lib/xqsr3/extensions/string/ends_with.rb +1 -1
  37. data/lib/xqsr3/extensions/string/map_option_string.rb +4 -4
  38. data/lib/xqsr3/extensions/string/nil_if_empty.rb +1 -1
  39. data/lib/xqsr3/extensions/string/nil_if_whitespace.rb +1 -1
  40. data/lib/xqsr3/extensions/string/quote_if.rb +1 -1
  41. data/lib/xqsr3/extensions/string/starts_with.rb +1 -1
  42. data/lib/xqsr3/extensions/string/to_bool.rb +8 -8
  43. data/lib/xqsr3/extensions/string/to_symbol.rb +1 -1
  44. data/lib/xqsr3/extensions/string/truncate.rb +1 -1
  45. data/lib/xqsr3/extensions/test/unit/assert_eql.rb +7 -7
  46. data/lib/xqsr3/extensions/test/unit/assert_false.rb +6 -6
  47. data/lib/xqsr3/extensions/test/unit/assert_not.rb +6 -6
  48. data/lib/xqsr3/extensions/test/unit/assert_not_eql.rb +7 -7
  49. data/lib/xqsr3/extensions/test/unit/assert_raise_with_message.rb +61 -61
  50. data/lib/xqsr3/extensions/test/unit/assert_subclass_of.rb +7 -7
  51. data/lib/xqsr3/extensions/test/unit/assert_superclass_of.rb +7 -7
  52. data/lib/xqsr3/extensions/test/unit/assert_true.rb +6 -6
  53. data/lib/xqsr3/extensions/test/unit/assert_type_has_instance_methods.rb +36 -36
  54. data/lib/xqsr3/extensions.rb +5 -5
  55. data/lib/xqsr3/hash_utilities/deep_transform.rb +65 -65
  56. data/lib/xqsr3/hash_utilities/key_matching.rb +77 -77
  57. data/lib/xqsr3/hash_utilities.rb +3 -3
  58. data/lib/xqsr3/internal_/test_unit_version_.rb +85 -85
  59. data/lib/xqsr3/io/writelines.rb +119 -119
  60. data/lib/xqsr3/quality/parameter_checking.rb +445 -445
  61. data/lib/xqsr3/quality.rb +2 -2
  62. data/lib/xqsr3/string_utilities/ends_with.rb +59 -59
  63. data/lib/xqsr3/string_utilities/nil_if_empty.rb +28 -28
  64. data/lib/xqsr3/string_utilities/nil_if_whitespace.rb +29 -29
  65. data/lib/xqsr3/string_utilities/quote_if.rb +50 -50
  66. data/lib/xqsr3/string_utilities/starts_with.rb +59 -59
  67. data/lib/xqsr3/string_utilities/to_symbol.rb +75 -75
  68. data/lib/xqsr3/string_utilities/truncate.rb +55 -55
  69. data/lib/xqsr3/string_utilities.rb +8 -8
  70. data/lib/xqsr3/version.rb +12 -12
  71. data/test/performance/frequency_map.rb +12 -12
  72. data/test/scratch/test_assert_raise_with_message.rb +11 -11
  73. data/test/unit/array_utilities/tc_join_with_or.rb +140 -140
  74. data/test/unit/command_line_utilities/tc_map_option_string.rb +18 -18
  75. data/test/unit/containers/tc_frequency_map.rb +591 -591
  76. data/test/unit/containers/tc_multi_map.rb +558 -558
  77. data/test/unit/conversion/tc_integer_parser.rb +72 -72
  78. data/test/unit/conversion/tc_to_bool.rb +25 -25
  79. data/test/unit/diagnostics/exceptions/tc_with_cause.rb +165 -165
  80. data/test/unit/diagnostics/tc_exception_utilities.rb +156 -156
  81. data/test/unit/extensions/enumerable/tc_collect_with_index.rb +14 -14
  82. data/test/unit/extensions/enumerable/tc_detect_map.rb +20 -20
  83. data/test/unit/extensions/enumerable/tc_unique.rb +34 -34
  84. data/test/unit/extensions/hash/tc_deep_transform.rb +22 -22
  85. data/test/unit/extensions/hash/tc_except.rb +28 -28
  86. data/test/unit/extensions/hash/tc_slice.rb +13 -13
  87. data/test/unit/extensions/integer/tc_to_s_grp.rb +60 -0
  88. data/test/unit/extensions/integer/ts_all.rb +12 -0
  89. data/test/unit/extensions/io/tc_writelines.rb +77 -77
  90. data/test/unit/extensions/kernel/tc_integer.rb +75 -75
  91. data/test/unit/extensions/kernel/tc_raise_with_options.rb +155 -155
  92. data/test/unit/extensions/object/tc_inspect.rb +50 -50
  93. data/test/unit/extensions/string/tc_bool.tb +24 -24
  94. data/test/unit/extensions/string/tc_ends_with.rb +53 -53
  95. data/test/unit/extensions/string/tc_map_option_string.rb +15 -15
  96. data/test/unit/extensions/string/tc_nil_if_empty.rb +8 -8
  97. data/test/unit/extensions/string/tc_nil_if_whitespace.rb +8 -8
  98. data/test/unit/extensions/string/tc_quote_if.rb +18 -18
  99. data/test/unit/extensions/string/tc_starts_with.rb +53 -53
  100. data/test/unit/extensions/string/tc_to_symbol.rb +26 -26
  101. data/test/unit/extensions/string/tc_truncate.rb +18 -18
  102. data/test/unit/extensions/test/unit/tc_assert_raise_with_message.rb +16 -16
  103. data/test/unit/extensions/test/unit/tc_assert_subclass_of.rb +9 -9
  104. data/test/unit/extensions/test/unit/tc_assert_superclass_of.rb +9 -9
  105. data/test/unit/hash_utilities/tc_has_match.rb +70 -70
  106. data/test/unit/hash_utilities/tc_match.rb +83 -83
  107. data/test/unit/io/tc_writelines.rb +106 -106
  108. data/test/unit/quality/tc_parameter_checking.rb +389 -389
  109. data/test/unit/string_utilities/tc_truncate.rb +27 -27
  110. data/test/unit/tc_version.rb +15 -15
  111. metadata +6 -2
@@ -10,46 +10,46 @@ require 'test/unit'
10
10
 
11
11
  class Test_Xqsr3_HashUtilities_has_match_by_module < Test::Unit::TestCase
12
12
 
13
- Matching = ::Xqsr3::HashUtilities::KeyMatching
14
-
15
- def test_against_none_re
16
-
17
- h = {
18
-
19
- :abc => :abc,
20
- 'abc' => 'abc',
21
- 'def' => 'def',
22
- :nil => nil,
23
- :sym => :sym,
24
- }
25
-
26
- assert_false Matching.has_match?(h, '')
27
- assert_true Matching.has_match?(h, 'def')
28
- assert_false Matching.has_match?(h, 'ghi')
29
- assert_true Matching.has_match?(h, :nil)
30
- assert_false Matching.has_match?(h, 'nil')
31
- assert_true Matching.has_match?(h, :sym)
32
- assert_false Matching.has_match?(h, 'sym')
33
- end
34
-
35
- def test_against_empty_re
36
-
37
- h = {
38
-
39
- :abc => :abc,
40
- 'abc' => 'abc',
41
- 'def' => 'def',
42
- :nil => nil,
43
- :sym => :sym,
44
- }
45
-
46
- assert_true Matching.has_match?(h, //)
47
-
48
- assert_true Matching.has_match?(h, /def/)
49
- assert_true Matching.has_match?(h, /de/)
50
- assert_true Matching.has_match?(h, /^de/)
51
- assert_false Matching.has_match?(h, /de$/)
52
- end
13
+ Matching = ::Xqsr3::HashUtilities::KeyMatching
14
+
15
+ def test_against_none_re
16
+
17
+ h = {
18
+
19
+ :abc => :abc,
20
+ 'abc' => 'abc',
21
+ 'def' => 'def',
22
+ :nil => nil,
23
+ :sym => :sym,
24
+ }
25
+
26
+ assert_false Matching.has_match?(h, '')
27
+ assert_true Matching.has_match?(h, 'def')
28
+ assert_false Matching.has_match?(h, 'ghi')
29
+ assert_true Matching.has_match?(h, :nil)
30
+ assert_false Matching.has_match?(h, 'nil')
31
+ assert_true Matching.has_match?(h, :sym)
32
+ assert_false Matching.has_match?(h, 'sym')
33
+ end
34
+
35
+ def test_against_empty_re
36
+
37
+ h = {
38
+
39
+ :abc => :abc,
40
+ 'abc' => 'abc',
41
+ 'def' => 'def',
42
+ :nil => nil,
43
+ :sym => :sym,
44
+ }
45
+
46
+ assert_true Matching.has_match?(h, //)
47
+
48
+ assert_true Matching.has_match?(h, /def/)
49
+ assert_true Matching.has_match?(h, /de/)
50
+ assert_true Matching.has_match?(h, /^de/)
51
+ assert_false Matching.has_match?(h, /de$/)
52
+ end
53
53
  end
54
54
 
55
55
 
@@ -57,44 +57,44 @@ require 'xqsr3/extensions/hash/has_match'
57
57
 
58
58
  class Test_Xqsr3_HashUtilities_has_match_by_include < Test::Unit::TestCase
59
59
 
60
- def test_against_none_re
60
+ def test_against_none_re
61
61
 
62
- h = {
62
+ h = {
63
63
 
64
- :abc => :abc,
65
- 'abc' => 'abc',
66
- 'def' => 'def',
67
- :nil => nil,
68
- :sym => :sym,
69
- }
64
+ :abc => :abc,
65
+ 'abc' => 'abc',
66
+ 'def' => 'def',
67
+ :nil => nil,
68
+ :sym => :sym,
69
+ }
70
70
 
71
- assert_false h.has_match?('')
72
- assert_true h.has_match?('def')
73
- assert_false h.has_match?('ghi')
74
- assert_true h.has_match?(:nil)
75
- assert_false h.has_match?('nil')
76
- assert_true h.has_match?(:sym)
77
- assert_false h.has_match?('sym')
78
- end
71
+ assert_false h.has_match?('')
72
+ assert_true h.has_match?('def')
73
+ assert_false h.has_match?('ghi')
74
+ assert_true h.has_match?(:nil)
75
+ assert_false h.has_match?('nil')
76
+ assert_true h.has_match?(:sym)
77
+ assert_false h.has_match?('sym')
78
+ end
79
79
 
80
- def test_against_empty_re
80
+ def test_against_empty_re
81
81
 
82
- h = {
82
+ h = {
83
83
 
84
- :abc => :abc,
85
- 'abc' => 'abc',
86
- 'def' => 'def',
87
- :nil => nil,
88
- :sym => :sym,
89
- }
84
+ :abc => :abc,
85
+ 'abc' => 'abc',
86
+ 'def' => 'def',
87
+ :nil => nil,
88
+ :sym => :sym,
89
+ }
90
90
 
91
- assert_true h.has_match?(//)
91
+ assert_true h.has_match?(//)
92
92
 
93
- assert_true h.has_match?(/def/)
94
- assert_true h.has_match?(/de/)
95
- assert_true h.has_match?(/^de/)
96
- assert_false h.has_match?(/de$/)
97
- end
93
+ assert_true h.has_match?(/def/)
94
+ assert_true h.has_match?(/de/)
95
+ assert_true h.has_match?(/^de/)
96
+ assert_false h.has_match?(/de$/)
97
+ end
98
98
  end
99
99
 
100
100
 
@@ -10,61 +10,61 @@ require 'test/unit'
10
10
 
11
11
  class Test_Xqsr3_HashUtilities_match_by_module < Test::Unit::TestCase
12
12
 
13
- Matching = ::Xqsr3::HashUtilities::KeyMatching
13
+ Matching = ::Xqsr3::HashUtilities::KeyMatching
14
14
 
15
- def test_against_none_re
15
+ def test_against_none_re
16
16
 
17
- h = {
17
+ h = {
18
18
 
19
- :abc => :abc,
20
- 'abc' => 'abc',
21
- 'def' => 'def',
22
- :nil => nil,
23
- :sym => :sym,
24
- }
19
+ :abc => :abc,
20
+ 'abc' => 'abc',
21
+ 'def' => 'def',
22
+ :nil => nil,
23
+ :sym => :sym,
24
+ }
25
25
 
26
- assert_nil Matching.match(h, '')
27
- assert_not_nil Matching.match(h, 'def')
28
- assert_nil Matching.match(h, 'ghi')
29
- assert_nil Matching.match(h, :nil) # although this is matching!
30
- assert_nil Matching.match(h, 'nil')
31
- assert_not_nil Matching.match(h, :sym)
32
- assert_nil Matching.match(h, 'sym')
33
- end
26
+ assert_nil Matching.match(h, '')
27
+ assert_not_nil Matching.match(h, 'def')
28
+ assert_nil Matching.match(h, 'ghi')
29
+ assert_nil Matching.match(h, :nil) # although this is matching!
30
+ assert_nil Matching.match(h, 'nil')
31
+ assert_not_nil Matching.match(h, :sym)
32
+ assert_nil Matching.match(h, 'sym')
33
+ end
34
34
 
35
- def test_against_empty_re
35
+ def test_against_empty_re
36
36
 
37
- h = {
37
+ h = {
38
38
 
39
- :abc => :abc,
40
- 'abc' => 'abc',
41
- 'def' => 'def',
42
- :nil => nil,
43
- :sym => :sym,
44
- }
39
+ :abc => :abc,
40
+ 'abc' => 'abc',
41
+ 'def' => 'def',
42
+ :nil => nil,
43
+ :sym => :sym,
44
+ }
45
45
 
46
- assert_not_nil Matching.match(h, //)
47
- assert_equal h.first[1], Matching.match(h, //)
46
+ assert_not_nil Matching.match(h, //)
47
+ assert_equal h.first[1], Matching.match(h, //)
48
48
 
49
- assert_equal 'def', Matching.match(h, /def/)
50
- assert_equal 'def', Matching.match(h, /de/)
51
- assert_equal 'def', Matching.match(h, /^de/)
52
- assert_nil Matching.match(h, /de$/)
53
- end
49
+ assert_equal 'def', Matching.match(h, /def/)
50
+ assert_equal 'def', Matching.match(h, /de/)
51
+ assert_equal 'def', Matching.match(h, /^de/)
52
+ assert_nil Matching.match(h, /de$/)
53
+ end
54
54
 
55
- def test_hash_containing_re
55
+ def test_hash_containing_re
56
56
 
57
- h = {
57
+ h = {
58
58
 
59
- /bc/ => :bc,
60
- /de/ => :de,
61
- :abc => :abc,
62
- }
59
+ /bc/ => :bc,
60
+ /de/ => :de,
61
+ :abc => :abc,
62
+ }
63
63
 
64
- assert_nil Matching.match(h, '')
65
- assert_nil Matching.match(h, :ab)
66
- assert_equal :bc, Matching.match(h, :abcd)
67
- end
64
+ assert_nil Matching.match(h, '')
65
+ assert_nil Matching.match(h, :ab)
66
+ assert_equal :bc, Matching.match(h, :abcd)
67
+ end
68
68
  end
69
69
 
70
70
 
@@ -72,59 +72,59 @@ require 'xqsr3/extensions/hash/match'
72
72
 
73
73
  class Test_Xqsr3_HashUtilities_match_by_include < Test::Unit::TestCase
74
74
 
75
- def test_against_none_re
75
+ def test_against_none_re
76
76
 
77
- h = {
77
+ h = {
78
78
 
79
- :abc => :abc,
80
- 'abc' => 'abc',
81
- 'def' => 'def',
82
- :nil => nil,
83
- :sym => :sym,
84
- }
79
+ :abc => :abc,
80
+ 'abc' => 'abc',
81
+ 'def' => 'def',
82
+ :nil => nil,
83
+ :sym => :sym,
84
+ }
85
85
 
86
- assert_nil h.match('')
87
- assert_not_nil h.match('def')
88
- assert_nil h.match('ghi')
89
- assert_nil h.match(:nil) # although this is matching!
90
- assert_nil h.match('nil')
91
- assert_not_nil h.match(:sym)
92
- assert_nil h.match('sym')
93
- end
86
+ assert_nil h.match('')
87
+ assert_not_nil h.match('def')
88
+ assert_nil h.match('ghi')
89
+ assert_nil h.match(:nil) # although this is matching!
90
+ assert_nil h.match('nil')
91
+ assert_not_nil h.match(:sym)
92
+ assert_nil h.match('sym')
93
+ end
94
94
 
95
- def test_against_empty_re
95
+ def test_against_empty_re
96
96
 
97
- h = {
97
+ h = {
98
98
 
99
- :abc => :abc,
100
- 'abc' => 'abc',
101
- 'def' => 'def',
102
- :nil => nil,
103
- :sym => :sym,
104
- }
99
+ :abc => :abc,
100
+ 'abc' => 'abc',
101
+ 'def' => 'def',
102
+ :nil => nil,
103
+ :sym => :sym,
104
+ }
105
105
 
106
- assert_not_nil h.match(//)
107
- assert_equal h.first[1], h.match(//)
106
+ assert_not_nil h.match(//)
107
+ assert_equal h.first[1], h.match(//)
108
108
 
109
- assert_equal 'def', h.match(/def/)
110
- assert_equal 'def', h.match(/de/)
111
- assert_equal 'def', h.match(/^de/)
112
- assert_nil h.match(/de$/)
113
- end
109
+ assert_equal 'def', h.match(/def/)
110
+ assert_equal 'def', h.match(/de/)
111
+ assert_equal 'def', h.match(/^de/)
112
+ assert_nil h.match(/de$/)
113
+ end
114
114
 
115
- def test_hash_containing_re
115
+ def test_hash_containing_re
116
116
 
117
- h = {
117
+ h = {
118
118
 
119
- /bc/ => :bc,
120
- /de/ => :de,
121
- :abc => :abc,
122
- }
119
+ /bc/ => :bc,
120
+ /de/ => :de,
121
+ :abc => :abc,
122
+ }
123
123
 
124
- assert_nil h.match('')
125
- assert_nil h.match(:ab)
126
- assert_equal :bc, h.match(:abcd)
127
- end
124
+ assert_nil h.match('')
125
+ assert_nil h.match(:ab)
126
+ assert_equal :bc, h.match(:abcd)
127
+ end
128
128
  end
129
129
 
130
130
 
@@ -11,188 +11,188 @@ include ::Xqsr3::IO
11
11
 
12
12
  class Test_Xqsr3_IO_writelines < Test::Unit::TestCase
13
13
 
14
- def test_single_string
14
+ def test_single_string
15
15
 
16
- input = 'abc'
16
+ input = 'abc'
17
17
 
18
- s = StringIO.new '', 'a'
18
+ s = StringIO.new '', 'a'
19
19
 
20
- r = ::Xqsr3::IO.writelines s, input
20
+ r = ::Xqsr3::IO.writelines s, input
21
21
 
22
- assert_equal 1, r
23
- assert_equal "abc\n", s.string
24
- end
22
+ assert_equal 1, r
23
+ assert_equal "abc\n", s.string
24
+ end
25
25
 
26
- def test_single_string_in_array
26
+ def test_single_string_in_array
27
27
 
28
- input = [ 'abc' ]
28
+ input = [ 'abc' ]
29
29
 
30
- s = StringIO.new '', 'a'
30
+ s = StringIO.new '', 'a'
31
31
 
32
- r = ::Xqsr3::IO.writelines s, input
32
+ r = ::Xqsr3::IO.writelines s, input
33
33
 
34
- assert_equal 1, r
35
- assert_equal "abc\n", s.string
36
- end
34
+ assert_equal 1, r
35
+ assert_equal "abc\n", s.string
36
+ end
37
37
 
38
- def test_single_string_in_hash
38
+ def test_single_string_in_hash
39
39
 
40
- input = { 'abc' => '' }
40
+ input = { 'abc' => '' }
41
41
 
42
- s = StringIO.new '', 'a'
42
+ s = StringIO.new '', 'a'
43
43
 
44
- r = ::Xqsr3::IO.writelines s, input
44
+ r = ::Xqsr3::IO.writelines s, input
45
45
 
46
- assert_equal 1, r
47
- assert_equal "abc\n", s.string
48
- end
46
+ assert_equal 1, r
47
+ assert_equal "abc\n", s.string
48
+ end
49
49
 
50
- def test_two_strings_in_array
50
+ def test_two_strings_in_array
51
51
 
52
- input = [ 'abc', 'def' ]
52
+ input = [ 'abc', 'def' ]
53
53
 
54
- s = StringIO.new '', 'a'
54
+ s = StringIO.new '', 'a'
55
55
 
56
- r = ::Xqsr3::IO.writelines s, input
56
+ r = ::Xqsr3::IO.writelines s, input
57
57
 
58
- assert_equal 2, r
59
- assert_equal "abc\ndef\n", s.string
60
- end
58
+ assert_equal 2, r
59
+ assert_equal "abc\ndef\n", s.string
60
+ end
61
61
 
62
- def test_two_strings_in_array_with_suppressed_eol
62
+ def test_two_strings_in_array_with_suppressed_eol
63
63
 
64
- input = [ 'abc', 'def' ]
64
+ input = [ 'abc', 'def' ]
65
65
 
66
- s = StringIO.new '', 'a'
66
+ s = StringIO.new '', 'a'
67
67
 
68
- r = ::Xqsr3::IO.writelines s, input, line_separator: ''
68
+ r = ::Xqsr3::IO.writelines s, input, line_separator: ''
69
69
 
70
- assert_equal 2, r
71
- assert_equal "abcdef", s.string
72
- end
70
+ assert_equal 2, r
71
+ assert_equal "abcdef", s.string
72
+ end
73
73
 
74
- def test_two_strings_in_hash
74
+ def test_two_strings_in_hash
75
75
 
76
- input = { 'ab' => 'c', 'de' => 'f' }
76
+ input = { 'ab' => 'c', 'de' => 'f' }
77
77
 
78
- s = StringIO.new '', 'a'
78
+ s = StringIO.new '', 'a'
79
79
 
80
- r = ::Xqsr3::IO.writelines s, input
80
+ r = ::Xqsr3::IO.writelines s, input
81
81
 
82
- assert_equal 2, r
83
- assert_equal "abc\ndef\n", s.string
84
- end
82
+ assert_equal 2, r
83
+ assert_equal "abc\ndef\n", s.string
84
+ end
85
85
 
86
- def test_two_strings_in_hash_with_col_sep
86
+ def test_two_strings_in_hash_with_col_sep
87
87
 
88
- input = { 'ab' => 'c', 'de' => 'f' }
88
+ input = { 'ab' => 'c', 'de' => 'f' }
89
89
 
90
- s = StringIO.new '', 'a'
90
+ s = StringIO.new '', 'a'
91
91
 
92
- r = ::Xqsr3::IO.writelines s, input, column_separator: "\t"
92
+ r = ::Xqsr3::IO.writelines s, input, column_separator: "\t"
93
93
 
94
- assert_equal 2, r
95
- assert_equal "ab\tc\nde\tf\n", s.string
96
- end
94
+ assert_equal 2, r
95
+ assert_equal "ab\tc\nde\tf\n", s.string
96
+ end
97
97
 
98
- def test_ten_strings_in_array
98
+ def test_ten_strings_in_array
99
99
 
100
- input = (0...10).map { |i| i.to_s }
100
+ input = (0...10).map { |i| i.to_s }
101
101
 
102
- s = StringIO.new
102
+ s = StringIO.new
103
103
 
104
- r = ::Xqsr3::IO.writelines s, input
104
+ r = ::Xqsr3::IO.writelines s, input
105
105
 
106
- assert_equal 10, r
107
- assert_equal "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n", s.string
108
- end
106
+ assert_equal 10, r
107
+ assert_equal "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n", s.string
108
+ end
109
109
 
110
- def test_strings_with_cr_in_array
110
+ def test_strings_with_cr_in_array
111
111
 
112
- input = [ "abc\n", "def\n", "ghi\n" ]
112
+ input = [ "abc\n", "def\n", "ghi\n" ]
113
113
 
114
- s = StringIO.new
114
+ s = StringIO.new
115
115
 
116
- r = ::Xqsr3::IO.writelines s, input
116
+ r = ::Xqsr3::IO.writelines s, input
117
117
 
118
- assert_equal 3, r
119
- assert_equal "abc\ndef\nghi\n", s.string
120
- end
118
+ assert_equal 3, r
119
+ assert_equal "abc\ndef\nghi\n", s.string
120
+ end
121
121
 
122
- def test_strings_with_cr_in_array_and_line_sep
122
+ def test_strings_with_cr_in_array_and_line_sep
123
123
 
124
- input = [ "abc\n", "def\n", "ghi\n" ]
124
+ input = [ "abc\n", "def\n", "ghi\n" ]
125
125
 
126
- s = StringIO.new
126
+ s = StringIO.new
127
127
 
128
- r = ::Xqsr3::IO.writelines s, input, line_separator: '|'
128
+ r = ::Xqsr3::IO.writelines s, input, line_separator: '|'
129
129
 
130
- assert_equal 3, r
131
- assert_equal "abc\n|def\n|ghi\n|", s.string
132
- end
130
+ assert_equal 3, r
131
+ assert_equal "abc\n|def\n|ghi\n|", s.string
132
+ end
133
133
 
134
- def test_many_strings_in_array_with_eol
134
+ def test_many_strings_in_array_with_eol
135
135
 
136
- input = []
136
+ input = []
137
137
 
138
- (0...1000).each { |n| input << "entry-#{n.to_s().rjust(4, '0')}\n" }
138
+ (0...1000).each { |n| input << "entry-#{n.to_s().rjust(4, '0')}\n" }
139
139
 
140
- assert_equal 1000, input.size
140
+ assert_equal 1000, input.size
141
141
 
142
- s = StringIO.new
142
+ s = StringIO.new
143
143
 
144
- r = ::Xqsr3::IO.writelines s, input
144
+ r = ::Xqsr3::IO.writelines s, input
145
145
 
146
- assert_equal 1000, r
147
- assert_equal "entry-0000\nentry-0001\n", s.string[0 ... 22]
148
- end
146
+ assert_equal 1000, r
147
+ assert_equal "entry-0000\nentry-0001\n", s.string[0 ... 22]
148
+ end
149
149
 
150
- def test_many_strings_in_array_without_eol
150
+ def test_many_strings_in_array_without_eol
151
151
 
152
- input = []
152
+ input = []
153
153
 
154
- (0...1000).each { |n| input << "entry-#{n.to_s().rjust(4, '0')}" }
154
+ (0...1000).each { |n| input << "entry-#{n.to_s().rjust(4, '0')}" }
155
155
 
156
- assert_equal 1000, input.size
156
+ assert_equal 1000, input.size
157
157
 
158
- s = StringIO.new
158
+ s = StringIO.new
159
159
 
160
- r = ::Xqsr3::IO.writelines s, input
160
+ r = ::Xqsr3::IO.writelines s, input
161
161
 
162
- assert_equal 1000, r
163
- assert_equal "entry-0000\nentry-0001\n", s.string[0 ... 22]
164
- end
162
+ assert_equal 1000, r
163
+ assert_equal "entry-0000\nentry-0001\n", s.string[0 ... 22]
164
+ end
165
165
 
166
- def test_many_strings_in_array_with_eol_and_line_sep
166
+ def test_many_strings_in_array_with_eol_and_line_sep
167
167
 
168
- input = []
168
+ input = []
169
169
 
170
- (0...1000).each { |n| input << "entry-#{n.to_s().rjust(4, '0')}\n" }
170
+ (0...1000).each { |n| input << "entry-#{n.to_s().rjust(4, '0')}\n" }
171
171
 
172
- assert_equal 1000, input.size
172
+ assert_equal 1000, input.size
173
173
 
174
- s = StringIO.new
174
+ s = StringIO.new
175
175
 
176
- r = ::Xqsr3::IO.writelines s, input, line_separator: '|'
176
+ r = ::Xqsr3::IO.writelines s, input, line_separator: '|'
177
177
 
178
- assert_equal 1000, r
179
- assert_equal "entry-0000\n|entry-0001\n|", s.string[0 ... 24]
180
- end
178
+ assert_equal 1000, r
179
+ assert_equal "entry-0000\n|entry-0001\n|", s.string[0 ... 24]
180
+ end
181
181
 
182
- def test_many_strings_in_array_without_eol_and_line_sep
182
+ def test_many_strings_in_array_without_eol_and_line_sep
183
183
 
184
- input = []
184
+ input = []
185
185
 
186
- (0...1000).each { |n| input << "entry-#{n.to_s().rjust(4, '0')}" }
186
+ (0...1000).each { |n| input << "entry-#{n.to_s().rjust(4, '0')}" }
187
187
 
188
- assert_equal 1000, input.size
188
+ assert_equal 1000, input.size
189
189
 
190
- s = StringIO.new
190
+ s = StringIO.new
191
191
 
192
- r = ::Xqsr3::IO.writelines s, input, line_separator: '|'
192
+ r = ::Xqsr3::IO.writelines s, input, line_separator: '|'
193
193
 
194
- assert_equal 1000, r
195
- assert_equal "entry-0000|entry-0001|", s.string[0 ... 22]
196
- end
194
+ assert_equal 1000, r
195
+ assert_equal "entry-0000|entry-0001|", s.string[0 ... 22]
196
+ end
197
197
  end
198
198