Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

ActionPack, 1.9.2-head 3 failing tests regarding encodings

#4701

Rails Master ActionPack, ruby 1.9.2dev (2010-05-08 trunk 27665) [x86_64-linux] has 3 failing tests.

The stacktrace is as follows:

1) Failure: (TextHelperTest) [test/template/text_helper_test.rb:221]: <"...\x83ciency could not be..."> expected but was
<"...fficiency could not be...">.

2) Failure: test_truncate_multibyte(TextHelperTest) [test/template/text_helper_test.rb:87]:
<"\xEC\x95\x88\xEB\x85\x95\xED..."> expected but was
<"안녕하세요">.

3) Failure: test_scoping_by_partial_of_an_array(TranslationHelperTest) [test/template/translation_helper_test.rb:41]:
<"foobar"> expected but was
<"["foo", "bar"]">.

2704 tests, 11359 assertions, 3 failures, 0 errors, 0 skips

Note: It's best to run the tests yourself, because I don't think some of the chars got copied from my terminal properly.

Regarding the first 2 failures, it happens when force_encoding is not used.

The failing assert is as follows:

assert_equal("...\203ciency could not be...", excerpt("That's why e\357\254\203ciency could not be helped", 'could', 8))

Note that:

"...\203ciency could not be...".encoding => ASCII-8BIT excerpt("That's why e\357\254\203ciency could not be helped", 'could', 8).encoding => UTF-8

Similarly the 2nd test. I'm looking into the 3rd test now.

Reported by Rohit Arondekar · May 26th, 2010 @ 07:19 AM

State: committed
Milestone: 3.0.2
Assigned to: Yehuda Katz (wycats) Yehuda Katz (wycats)
Importance: Low

Activity

  1. Rohit Arondekar
    Rohit Arondekar

    The 3rd failure seems like a mistake in the return value of t. I've attached a patch to fix this (if it's indeed the problem).

    May 26th, 2010 @ 07:31 AM

  2. Rohit Arondekar
    Rohit Arondekar

    Bad formatting in the original message.

    This is regarding the first 2 tests, asserts without force_encoding:

    The string literals have encoding of ASCII-8BIT
    "...\203ciency could not be...".encoding => ASCII-8BIT

    Whereas, excerpt returns a UTF-8 string, and hence the tests fail.
    excerpt("That's why e\357\254\203ciency could not be helped", 'could', 8).encoding => UTF-8

    May 26th, 2010 @ 04:32 PM

  3. Santiago Pastorino
    Santiago Pastorino
    • Milestone cleared.
    • State changed from new to open

    That's not the proper fix Rohit.
    This test is fixed here.

    May 26th, 2010 @ 04:56 PM

  4. Rohit Arondekar
    Rohit Arondekar

    Santiago, thanks for the proper fix. I've never used translation so I didn't know what t() is supposed to return. Any idea how to fix the first 2 failures?

    May 27th, 2010 @ 03:12 AM

  5. Rohit Arondekar
    Rohit Arondekar

    +1 on the patch, the translation test now passes on 1.8.7 and 1.9.2-head.

    May 27th, 2010 @ 03:32 AM

  6. Repository
  7. Rohit Arondekar
    Rohit Arondekar

    I think it would be a good idea to mark this ticket resolved as the tests now pass after commit => http://github.com/rails/rails/commit/d7f6f2b596d00a7deb4f83592aaa78...

    But from the comment in the commit, ".mb_chars always returns UTF-8, even in 1.9. This is not great, but it's how it works. Let's work this out." (http://bit.ly/aUsn1o), a new dedicated ticket can be opened?

    May 30th, 2010 @ 06:20 AM

  8. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to committed

    [#OMG state:committed] with one t. So i'm closing by hand

    May 30th, 2010 @ 06:27 AM

  9. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to Low

    October 15th, 2010 @ 11:01 PM