ndr_support 5.10.4 → 5.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/LICENSE.txt +1 -1
- data/README.md +3 -3
- data/lib/ndr_support/concerns/working_days.rb +12 -1
- data/lib/ndr_support/string/clean_methodable.rb +4 -4
- data/lib/ndr_support/version.rb +1 -1
- data/ndr_support.gemspec +8 -6
- metadata +10 -73
- data/.gitignore +0 -19
- data/.rubocop.yml +0 -1
- data/Gemfile +0 -4
- data/Guardfile +0 -24
- data/Rakefile +0 -12
- data/code_safety.yml +0 -294
- data/gemfiles/Gemfile.rails70 +0 -6
- data/gemfiles/Gemfile.rails71 +0 -6
- data/gemfiles/Gemfile.rails72 +0 -6
- data/gemfiles/Gemfile.rails80 +0 -6
- data/test/array_test.rb +0 -20
- data/test/concerns/working_days_test.rb +0 -148
- data/test/date_and_time_extensions_test.rb +0 -82
- data/test/daterange_test.rb +0 -303
- data/test/hash_test.rb +0 -84
- data/test/integer/calculations_test.rb +0 -28
- data/test/integer/rounding_test.rb +0 -14
- data/test/integer/working_days_test.rb +0 -14
- data/test/nil_test.rb +0 -40
- data/test/obfuscator_test.rb +0 -26
- data/test/ourdate_test.rb +0 -26
- data/test/ourtime_test.rb +0 -45
- data/test/password_test.rb +0 -129
- data/test/regexp_range_test.rb +0 -136
- data/test/resources/filesystem_paths.yml +0 -37
- data/test/safe_file_test.rb +0 -670
- data/test/safe_path_test.rb +0 -168
- data/test/string/cleaning_test.rb +0 -247
- data/test/string/conversions_test.rb +0 -371
- data/test/test_helper.rb +0 -42
- data/test/threat_scanner_test.rb +0 -77
- data/test/utf8_encoding/control_characters_test.rb +0 -84
- data/test/utf8_encoding/force_binary_test.rb +0 -64
- data/test/utf8_encoding_test.rb +0 -170
- data/test/yaml/serialization_test.rb +0 -200
data/test/utf8_encoding_test.rb
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
# encoding: UTF-8
|
|
2
|
-
|
|
3
|
-
require 'test_helper'
|
|
4
|
-
|
|
5
|
-
class Utf8EncodingTest < Minitest::Test
|
|
6
|
-
extend UTF8Encoding
|
|
7
|
-
include UTF8Encoding
|
|
8
|
-
|
|
9
|
-
test 'ensure_utf8 should return a new string' do
|
|
10
|
-
string1 = 'hello'
|
|
11
|
-
string2 = ensure_utf8(string1)
|
|
12
|
-
|
|
13
|
-
refute string1.object_id == string2.object_id
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
test 'ensure_utf8! should return the same string' do
|
|
17
|
-
string1 = 'hello'
|
|
18
|
-
string2 = ensure_utf8!(string1)
|
|
19
|
-
|
|
20
|
-
assert string1.object_id == string2.object_id
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
test 'ensure_utf8_object! should work with arrays' do
|
|
24
|
-
array = []
|
|
25
|
-
expects(:ensure_utf8_array!).with(array).returns(array)
|
|
26
|
-
assert_equal array, ensure_utf8_object!(array)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
test 'ensure_utf8_array! should work on elements' do
|
|
30
|
-
element1 = 'hello'
|
|
31
|
-
element2 = :world
|
|
32
|
-
array = [element1, element2]
|
|
33
|
-
|
|
34
|
-
expects(:ensure_utf8_object!).with(element1)
|
|
35
|
-
expects(:ensure_utf8_object!).with(element2)
|
|
36
|
-
|
|
37
|
-
assert_equal array, ensure_utf8_array!(array)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
test 'ensure_utf8_object! should work with hashes' do
|
|
41
|
-
hash = {}
|
|
42
|
-
expects(:ensure_utf8_hash!).with(hash).returns(hash)
|
|
43
|
-
assert_equal hash, ensure_utf8_object!(hash)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
test 'ensure_utf8_hash! should work on values' do
|
|
47
|
-
element1 = 'hello'
|
|
48
|
-
element2 = :world
|
|
49
|
-
hash = { element1 => element2 }
|
|
50
|
-
|
|
51
|
-
expects(:ensure_utf8_object!).with(element1).never
|
|
52
|
-
expects(:ensure_utf8_object!).with(element2)
|
|
53
|
-
|
|
54
|
-
assert_equal hash, ensure_utf8_hash!(hash)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
test 'ensure_utf8_object! should work with strings' do
|
|
58
|
-
string = ''
|
|
59
|
-
expects(:ensure_utf8!).with(string).returns(string)
|
|
60
|
-
assert_equal string, ensure_utf8_object!(string)
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
test 'coerce_utf8 should return a new string' do
|
|
64
|
-
string1 = 'hello'
|
|
65
|
-
string2 = coerce_utf8(string1)
|
|
66
|
-
|
|
67
|
-
refute string1.object_id == string2.object_id
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
test 'coerce_utf8! should return the same string' do
|
|
71
|
-
string1 = 'hello'
|
|
72
|
-
string2 = coerce_utf8!(string1)
|
|
73
|
-
|
|
74
|
-
assert string1.object_id == string2.object_id
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
test 'ensure_utf8 should convert low bytes to UTF-8 if possible' do
|
|
78
|
-
string1 = 'hello'.force_encoding('Windows-1252')
|
|
79
|
-
string2 = ensure_utf8!(string1)
|
|
80
|
-
|
|
81
|
-
assert_equal string1, string2
|
|
82
|
-
assert_equal 'UTF-8', string2.encoding.name
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
test 'ensure_utf8 should convert high bytes to UTF-8 if possible' do
|
|
86
|
-
string1 = "dash \x96 dash".force_encoding('Windows-1252')
|
|
87
|
-
assert_equal 11, string1.bytes.to_a.length
|
|
88
|
-
assert_equal 11, string1.chars.to_a.length
|
|
89
|
-
|
|
90
|
-
assert string1.valid_encoding?
|
|
91
|
-
|
|
92
|
-
string2 = ensure_utf8(string1)
|
|
93
|
-
assert_equal 13, string2.bytes.to_a.length
|
|
94
|
-
assert_equal 11, string2.chars.to_a.length
|
|
95
|
-
|
|
96
|
-
assert_equal 'UTF-8', string2.encoding.name
|
|
97
|
-
assert string2.valid_encoding?
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
test 'ensure_utf8 should prefer a given encoding' do
|
|
101
|
-
string1 = "japan \x8e\xa6 ese"
|
|
102
|
-
assert_equal 12, string1.bytes.to_a.length
|
|
103
|
-
assert_equal 12, string1.chars.to_a.length
|
|
104
|
-
|
|
105
|
-
string2 = ensure_utf8(string1, 'EUC-JP')
|
|
106
|
-
assert_equal 13, string2.bytes.to_a.length
|
|
107
|
-
assert_equal 11, string2.chars.to_a.length
|
|
108
|
-
|
|
109
|
-
# "halfwidth katakana letter wo":
|
|
110
|
-
assert_equal [239, 189, 166], string2.bytes.to_a[6...9]
|
|
111
|
-
|
|
112
|
-
assert_equal 'UTF-8', string2.encoding.name
|
|
113
|
-
assert string2.valid_encoding?
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
test 'ensure_utf8 should handle UTF-16 strings (using bom)' do
|
|
117
|
-
alpha_beta_le = ensure_utf8("\xff\xfe\xb1\x03\xb2\x03") # Little endian
|
|
118
|
-
alpha_beta_be = ensure_utf8("\xfe\xff\x03\xb1\x03\xb2") # Big endian
|
|
119
|
-
|
|
120
|
-
assert_equal Encoding.find('UTF-8'), alpha_beta_le.encoding
|
|
121
|
-
assert_equal Encoding.find('UTF-8'), alpha_beta_be.encoding
|
|
122
|
-
|
|
123
|
-
assert_equal 2, alpha_beta_le.chars.to_a.length
|
|
124
|
-
assert_equal 2, alpha_beta_be.chars.to_a.length
|
|
125
|
-
|
|
126
|
-
assert_equal alpha_beta_be, alpha_beta_le
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
test 'EncodingError defined' do
|
|
130
|
-
assert defined?(EncodingError)
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
test 'UTF8CoercionError defined' do
|
|
134
|
-
assert defined?(UTF8Encoding::UTF8CoercionError)
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
test 'ensure_utf8 should fail if unable to derive encoding' do
|
|
138
|
-
assert_raises(UTF8Encoding::UTF8CoercionError) do
|
|
139
|
-
# Not going to work with UTF-8 or Windows-1252:
|
|
140
|
-
ensure_utf8("rubbish \x90 rubbish")
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
test 'coerce_utf8 should escape unmappable values' do
|
|
145
|
-
expected = 'rubbish 0x90 rubbish'
|
|
146
|
-
actual = coerce_utf8("rubbish \x90 rubbish")
|
|
147
|
-
|
|
148
|
-
assert_equal expected, actual
|
|
149
|
-
assert actual.valid_encoding?
|
|
150
|
-
assert_equal Encoding.find('UTF-8'), actual.encoding
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
test 'coerce_utf8 should use given source encoding' do
|
|
154
|
-
input = "maybe \xc0 rubbish"
|
|
155
|
-
win_expected = 'maybe À rubbish'
|
|
156
|
-
utf_expected = 'maybe 0xc0 rubbish'
|
|
157
|
-
|
|
158
|
-
win_actual = coerce_utf8(input, 'Windows-1252')
|
|
159
|
-
|
|
160
|
-
assert_equal win_expected, win_actual
|
|
161
|
-
assert win_actual.valid_encoding?
|
|
162
|
-
assert_equal Encoding.find('UTF-8'), win_actual.encoding
|
|
163
|
-
|
|
164
|
-
utf_actual = coerce_utf8(input, 'UTF-8')
|
|
165
|
-
|
|
166
|
-
assert_equal utf_expected, utf_actual
|
|
167
|
-
assert utf_actual.valid_encoding?
|
|
168
|
-
assert_equal Encoding.find('UTF-8'), utf_actual.encoding
|
|
169
|
-
end
|
|
170
|
-
end
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
require 'test_helper'
|
|
2
|
-
|
|
3
|
-
class SerializationTest < Minitest::Test
|
|
4
|
-
include NdrSupport::YAML::SerializationMigration
|
|
5
|
-
|
|
6
|
-
test 'should serialize then deserialize an object correctly' do
|
|
7
|
-
hash = { :a => 1 }
|
|
8
|
-
assert_equal hash, load_yaml(dump_yaml(hash))
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
test 'should support aliases correctly' do
|
|
12
|
-
x = { 'c' => 5 }
|
|
13
|
-
hash = { 'a' => x, 'b' => x }
|
|
14
|
-
hash_yaml = "---\na: &1\n c: 5\nb: *1\n"
|
|
15
|
-
assert_equal hash, load_yaml(hash_yaml), 'Deserialising known YAML with an alias'
|
|
16
|
-
assert_equal hash, load_yaml(dump_yaml(hash)), 'Deserialising a structure with repeated objects'
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
test 'should handle syck-encoded characters' do
|
|
20
|
-
assert_syck_1_8_yaml_loads_correctly
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
test 'should handle binary yaml with control chars' do
|
|
24
|
-
# irb> "\xC2\xA1null \x00 characters \r\n suck!".to_yaml
|
|
25
|
-
yaml = "--- !binary |-\n wqFudWxsIAAgY2hhcmFjdGVycyANCiBzdWNrIQ==\n"
|
|
26
|
-
assert_equal "¡null 0x00 characters \r\n suck!", load_yaml(yaml)
|
|
27
|
-
|
|
28
|
-
# irb> {fulltext: "\xC2\xA1null \x00 characters \r\n suck!"}.to_yaml
|
|
29
|
-
yamled_hash = "---\n:fulltext: !binary |-\n wqFudWxsIAAgY2hhcmFjdGVycyANCiBzdWNrIQ==\n"
|
|
30
|
-
assert_equal({ :fulltext => "¡null 0x00 characters \r\n suck!" }, load_yaml(yamled_hash))
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# Psych doesn't always base64-encode control characters:
|
|
34
|
-
test 'should handle non-binary yaml with control chars' do
|
|
35
|
-
#irb> Psych.dump("control \x01 char \n whoops!")
|
|
36
|
-
chr_1_yaml = "--- ! \"control \\x01 char \\n whoops!\"\n"
|
|
37
|
-
assert_equal "control 0x01 char \n whoops!", load_yaml(chr_1_yaml)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
test 'should handle non-binary yaml with escaped things that look like control chars' do
|
|
41
|
-
# irb> Psych.dump(['\\x01 \\xAF \\\\xAF', "\x01 \\\x01 \x01\\\x01"])
|
|
42
|
-
escaped_yaml = "---\n- \"\\\\x01 \\\\xAF \\\\\\\\xAF\"\n- \"\\x01 \\\\\\x01 \\x01\\\\\\x01\"\n"
|
|
43
|
-
assert_equal ['\\x01 \\xAF \\\\xAF', '0x01 \\0x01 0x01\\0x01'], load_yaml(escaped_yaml)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
test 'should leave non-binary JSON with things that look like control chars unchanged' do
|
|
47
|
-
hash = { 'report' => ' \x01 ' }
|
|
48
|
-
assert_equal hash, load_yaml(hash.to_json)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
test 'load_yaml should not coerce to UTF-8 by default' do
|
|
52
|
-
assert_yaml_coercion_behaviour
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
test 'dump_yaml with utf8_storage = false should produce encoding-portable YAML' do
|
|
56
|
-
self.utf8_storage = false
|
|
57
|
-
original_object = { basic: 'manana', complex: 'mañana' }
|
|
58
|
-
yaml_produced = dump_yaml(original_object)
|
|
59
|
-
reloaded_object = load_yaml(yaml_produced)
|
|
60
|
-
|
|
61
|
-
assert_match(/basic: manana/, yaml_produced, 'binary-encoded more than was necessary')
|
|
62
|
-
|
|
63
|
-
refute yaml_produced.bytes.detect { |byte| byte > 127 }, 'yaml has high-ascii'
|
|
64
|
-
assert reloaded_object.inspect.bytes.detect { |byte| byte > 127 }
|
|
65
|
-
assert_equal original_object, reloaded_object
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
test 'encoding-portable YAML with utf8_storage = false should be loadable' do
|
|
69
|
-
self.utf8_storage = false
|
|
70
|
-
original_object = { basic: 'manana', complex: 'mañana' }
|
|
71
|
-
yaml_produced = dump_yaml(original_object)
|
|
72
|
-
|
|
73
|
-
assert_equal("---\n:basic: manana\n:complex: !binary |-\n bWHDsWFuYQ==\n", yaml_produced)
|
|
74
|
-
|
|
75
|
-
reloaded_object = load_yaml(yaml_produced)
|
|
76
|
-
assert_equal original_object, reloaded_object
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
test 'non-encoding-portable YAML with utf8_storage = true should be loadable' do
|
|
80
|
-
self.utf8_storage = true
|
|
81
|
-
original_object = { basic: 'manana', complex: 'mañana' }
|
|
82
|
-
yaml_produced = dump_yaml(original_object)
|
|
83
|
-
assert_equal("---\n:basic: manana\n:complex: mañana\n", yaml_produced)
|
|
84
|
-
|
|
85
|
-
reloaded_object = load_yaml(yaml_produced)
|
|
86
|
-
assert_equal original_object, reloaded_object
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
test 'yaml_safe_classes should filter which classes can be loaded' do
|
|
90
|
-
original_object = { basic: 'manana', complex: 'mañana' }
|
|
91
|
-
yaml_produced = dump_yaml(original_object)
|
|
92
|
-
self.yaml_safe_classes = []
|
|
93
|
-
assert_raises Psych::DisallowedClass, 'Load should fail without Symbol in yaml_safe_classes' do
|
|
94
|
-
load_yaml(yaml_produced)
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
self.yaml_safe_classes = [Symbol]
|
|
98
|
-
reloaded_object = load_yaml(yaml_produced)
|
|
99
|
-
assert_equal original_object, reloaded_object, 'Safe reload with Symbol class specified'
|
|
100
|
-
|
|
101
|
-
if Psych::VERSION.start_with?('3.')
|
|
102
|
-
# Not supported with Ruby >= 3.1 unless you force psych version < 4
|
|
103
|
-
self.yaml_safe_classes = :unsafe
|
|
104
|
-
reloaded_object = load_yaml(yaml_produced)
|
|
105
|
-
assert_equal original_object, reloaded_object, 'Unsafe reload with Symbol class'
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
test 'time-like objects should serialise correctly with psych' do
|
|
110
|
-
assert_timey_wimey_stuff
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
private
|
|
114
|
-
|
|
115
|
-
def assert_timey_wimey_stuff
|
|
116
|
-
assert_times
|
|
117
|
-
assert_dates
|
|
118
|
-
assert_datetimes
|
|
119
|
-
assert_datetimes_with_zones
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
def assert_times
|
|
123
|
-
# Dumped by 1.9.3 syck, within era.
|
|
124
|
-
loaded = YAML.safe_load("--- !timestamp 2014-03-01\n", permitted_classes: YAML_SAFE_CLASSES)
|
|
125
|
-
assert [Date, Time].include?(loaded.class), '1.9.3 era timestamp class'
|
|
126
|
-
assert_equal 2014, loaded.year, '1.9.3 era timestamp year'
|
|
127
|
-
assert_equal 3, loaded.month, '1.9.3 era timestamp month'
|
|
128
|
-
assert_equal 1, loaded.day, '1.9.3 era timestamp day'
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
def assert_dates
|
|
132
|
-
date = Date.new(2014, 3, 1)
|
|
133
|
-
|
|
134
|
-
# Dumped by 1.8.7 syck, within era.
|
|
135
|
-
loaded = YAML.safe_load("--- 2014-03-01\n", permitted_classes: YAML_SAFE_CLASSES)
|
|
136
|
-
assert_equal date, loaded, '1.8.7 era date'
|
|
137
|
-
|
|
138
|
-
# Check default formatting does not affect serialisation:
|
|
139
|
-
assert_equal '01.03.2014', date.to_s
|
|
140
|
-
assert_equal date, YAML.safe_load(date.to_yaml, permitted_classes: YAML_SAFE_CLASSES)
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
def assert_datetimes
|
|
144
|
-
datetime = DateTime.new(2014, 3, 1, 12, 45, 15)
|
|
145
|
-
loaded = YAML.safe_load(datetime.to_yaml, permitted_classes: YAML_SAFE_CLASSES)
|
|
146
|
-
|
|
147
|
-
assert [DateTime, Time].include?(loaded.class), 'datetime class'
|
|
148
|
-
assert_equal datetime, loaded.to_datetime
|
|
149
|
-
assert_equal datetime.to_time, loaded.to_time
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
def assert_datetimes_with_zones
|
|
153
|
-
bst_datetime = DateTime.new(2014, 4, 1, 0, 0, 0, '+1')
|
|
154
|
-
bst_loaded = load_yaml(bst_datetime.to_yaml)
|
|
155
|
-
|
|
156
|
-
assert [DateTime, Time].include?(bst_loaded.class), 'bst datetime class'
|
|
157
|
-
assert_equal bst_datetime, bst_loaded.to_datetime
|
|
158
|
-
assert_equal bst_datetime.to_time, bst_loaded.to_time
|
|
159
|
-
|
|
160
|
-
gmt_datetime = DateTime.new(2014, 3, 1, 0, 0, 0, '+0')
|
|
161
|
-
gmt_loaded = load_yaml(gmt_datetime.to_yaml)
|
|
162
|
-
|
|
163
|
-
assert [DateTime, Time].include?(gmt_loaded.class), 'gmt datetime class'
|
|
164
|
-
assert_equal gmt_datetime, gmt_loaded.to_datetime
|
|
165
|
-
assert_equal gmt_datetime.to_time, gmt_loaded.to_time
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
def assert_syck_1_8_yaml_loads_correctly
|
|
169
|
-
yaml = "--- \nname: Dr. Doctor\000\000\000 \ndiagnosis: \"CIN 1 \\xE2\\x80\\x93 CIN 2\"\n"
|
|
170
|
-
hash = load_yaml(yaml)
|
|
171
|
-
|
|
172
|
-
# The null chars should be escaped:
|
|
173
|
-
assert_equal 'Dr. Doctor0x000x000x00', hash['name']
|
|
174
|
-
|
|
175
|
-
# The dash should be 3 bytes, but recognised as one char:
|
|
176
|
-
assert_equal 15, hash['diagnosis'].bytes.to_a.length
|
|
177
|
-
|
|
178
|
-
assert_syck_1_8_handles_encoding(hash)
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
def assert_syck_1_8_handles_encoding(hash)
|
|
182
|
-
assert_equal 13, hash['diagnosis'].chars.to_a.length
|
|
183
|
-
|
|
184
|
-
assert_equal 'UTF-8', hash['diagnosis'].encoding.name
|
|
185
|
-
assert hash['diagnosis'].valid_encoding?
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
def assert_yaml_coercion_behaviour
|
|
189
|
-
# UTF-8, with an unmappable byte too:
|
|
190
|
-
yaml = "---\nfulltextreport: \"Here is \\xE2\\x80\\x93 a weird \\x9D char\"\n"
|
|
191
|
-
|
|
192
|
-
# By default, we'd expect the (serialised) \x9D
|
|
193
|
-
assert_raises(UTF8Encoding::UTF8CoercionError) { load_yaml(yaml) }
|
|
194
|
-
|
|
195
|
-
# With the optional second argument, we can force an escape:
|
|
196
|
-
hash = load_yaml(yaml, true)
|
|
197
|
-
assert_equal 'Here is – a weird 0x9d char', hash['fulltextreport']
|
|
198
|
-
assert_equal 'UTF-8', hash['fulltextreport'].encoding.name
|
|
199
|
-
end
|
|
200
|
-
end
|