Permalink
Browse files

Fixed two failing tests for Ruby 1.9. Both were due to encoding probl…

…ems, just changed the force encoding on the test to match the expected results.
  • Loading branch information...
1 parent 5f71117 commit 245000f4ce4194b445719f96c3952b52f9ef84f4 @mikel committed Apr 1, 2008
Showing with 7 additions and 8 deletions.
  1. +2 −2 lib/tmail/mail.rb
  2. +1 −1 lib/tmail/utils.rb
  3. +1 −1 test/test_address.rb
  4. +3 −4 test/test_header.rb
View
@@ -408,8 +408,8 @@ def parse_header( f )
when /\AFrom (\S+)/
unixfrom = $1
- when /^charset=.*/
-
+ when /^charset=.*/
+
else
raise SyntaxError, "wrong mail header: '#{line.inspect}'"
end
View
@@ -118,7 +118,7 @@ module TextUtils
ATOM_UNSAFE = /[#{Regexp.quote aspecial}#{control}#{lwsp}]/n
PHRASE_UNSAFE = /[#{Regexp.quote aspecial}#{control}]/n
TOKEN_UNSAFE = /[#{Regexp.quote tspecial}#{control}#{lwsp}]/n
-
+
# Returns true if the string supplied is free from characters not allowed as an ATOM
def atom_safe?( str )
not ATOM_UNSAFE === str
@@ -213,7 +213,7 @@ def test_parse__mime
TMail.KCODE = 'SJIS'
expected = "\223\372\226{\214\352"
- expected.force_encoding('SJIS') if expected.respond_to? :force_encoding
+ expected.force_encoding('Windows-31J') if expected.respond_to? :force_encoding
validate_case__address\
'=?iso-2022-jp?B?GyRCRnxLXDhsGyhC?= <aamine@loveruby.net>',
:display_name => expected,
View
@@ -787,8 +787,7 @@ def _test_ATTRS
def _test_tspecials
h = TMail::HeaderField.new('Content-Disposition', 'a; n=a')
h['n'] = %q|()<>[];:@\\,"/?=|
- assert_equal 'a; n="()<>[];:@\\\\,\"/?="',
- h.encoded
+ assert_equal 'a; n="()<>[];:@\\\\,\"/?="', h.encoded
end
def _test_rfc2231_decode
@@ -867,7 +866,7 @@ def _test_raw_sjis
assert_equal 'attachment', h.disposition
assert_equal 1, h.params.size
expected = "\223\372\226{\214\352.doc"
- expected.force_encoding 'Shift_JIS' if expected.respond_to? :force_encoding
+ expected.force_encoding 'Windows-31J' if expected.respond_to? :force_encoding
assert_equal expected, h.params['filename']
# raw SJIS string in value (quoted-string)
@@ -895,7 +894,7 @@ def _test_code_conversion
assert_equal 'attachment', h.disposition
assert_equal 1, h.params.size
expected = "\223\372\226{\214\352.doc"
- expected.force_encoding 'Shift_JIS' if expected.respond_to? :force_encoding
+ expected.force_encoding 'Windows-31J' if expected.respond_to? :force_encoding
assert_equal expected, h.params['filename']
end

0 comments on commit 245000f

Please sign in to comment.