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.

Correct Regexp extension un/optionalize assertions and fix failures masked by false positives

#3102

This patch corrects the Regexp extension un/optionalize test assertions. Previously, assert was being used instead of assert_equal, producing false positives.

-  assert "", Regexp.optionalize("")
+  assert_equal "", Regexp.optionalize("")

The first will always pass since "" evaluates to true. It's clear that the original author intended assert_equal.

Fixing the assertions uncovered a failure which this patch also fixes:

test_optionalize(RegexpExtAccessTests)
    [./test/core_ext/regexp_ext_test.rb:18:in `test_optionalize'
<""> expected but was
<"(?:)?">.

Since the previous return value of /(?:)?/ will still match an empty string, behavior is unchanged (all Action Pack tests continue to pass), but based on the tests, "" was the return value the author intended.

Reported by Jeffrey Hardy · August 26th, 2009 @ 07:41 PM

State: resolved
Milestone: 2.3.4
Assigned to: nobody
Importance: none

Activity

  1. Jeremy Kemper
    Jeremy Kemper
    • State changed from new to open
    • Milestone set to 2.3.4

    Fixed on master, needs 2-3-stable backport since it lives in AP there

    August 26th, 2009 @ 10:40 PM

  2. Repository
  3. Jeremy Kemper
    Jeremy Kemper
    • State changed from incomplete to resolved

    August 26th, 2009 @ 11:43 PM