Project

General

Profile

Bug #6813 ยป 0001-Fix-test_encoding-failure-on-Windows.patch

h.shirosaki (Hiroshi Shirosaki), 07/30/2012 11:36 PM

View differences:

test/ruby/test_rubyoptions.rb
199 199
  end
200 200

  
201 201
  def test_encoding
202
    assert_in_out_err(%w(-Eutf-8), "p '\u3042'", [], /invalid multibyte char/)
203

  
204 202
    assert_in_out_err(%w(--encoding), "", [], /missing argument for --encoding/)
205 203

  
206 204
    assert_in_out_err(%w(--encoding test_ruby_test_rubyoptions_foobarbazqux), "", [],
207 205
                      /unknown encoding name - test_ruby_test_rubyoptions_foobarbazqux \(RuntimeError\)/)
208 206

  
209
    assert_in_out_err(%w(--encoding utf-8), "p '\u3042'", [], /invalid multibyte char/)
207
    if /mswin|mingw/ =~ RUBY_PLATFORM &&
208
      (str = "\u3042".force_encoding(Encoding.find("locale"))).valid_encoding?
209
      # This result depends on locale because LANG=C doesn't affect locale
210
      # on Windows.
211
      out, err = [str], []
212
    else
213
      out, err = [], /invalid multibyte char/
214
    end
215
    assert_in_out_err(%w(-Eutf-8), "puts '\u3042'", out, err)
216
    assert_in_out_err(%w(--encoding utf-8), "puts '\u3042'", out, err)
210 217
  end
211 218

  
212 219
  def test_syntax_check
213
-