r73552 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73551‎ | r73552 | r73553 >
Date:18:08, 22 September 2010
Author:aj
Status:deferred
Tags:
Comment:
fixed list error
Modified paths:
  • /trunk/parsers/libmwparser/src/mwparsercontext.c (modified) (history)
  • /trunk/parsers/libmwparser/tests/list/list1.out (modified) (history)
  • /trunk/parsers/libmwparser/tests/list/list4.in (added) (history)
  • /trunk/parsers/libmwparser/tests/list/list4.out (added) (history)
  • /trunk/parsers/libmwparser/tests/testsuite (modified) (history)
  • /trunk/parsers/libmwparser/tests/testsuite.at (modified) (history)

Diff [purge]

Index: trunk/parsers/libmwparser/src/mwparsercontext.c
@@ -721,7 +721,7 @@
722722 }
723723 closeLists(context, i);
724724 }
725 - if (s != NULL && s->len == type->len && i == s->len) {
 725+ if (s != NULL && s->len >= type->len && i == type->len) {
726726 ANTLR3_UCHAR c = type->charAt(type, type->len - 1);
727727 CASE(c, '*') { LSTNR->endBulletListItem(LSTNR); LSTNR->beginBulletListItem(LSTNR, NULL); } else
728728 CASE(c, '#') { LSTNR->endEnumerationItem(LSTNR); LSTNR->beginEnumerationItem(LSTNR, NULL); } else
@@ -730,7 +730,7 @@
731731 } else {
732732 assert(false); // Invalid character representing a list item.
733733 }
734 - if (type->charAt(type, type->len - 1) != s->charAt(s, s->len - 1)) {
 734+ if (type->len < s->len || type->charAt(type, type->len - 1) != s->charAt(s, s->len - 1)) {
735735 updateListState(context, type, s->len - 1);
736736 }
737737 } else {
Index: trunk/parsers/libmwparser/tests/testsuite
@@ -579,7 +579,7 @@
580580 # List of the tested programs.
581581 at_tested=''
582582 # List of the all the test groups.
583 -at_groups_all=' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34'
 583+at_groups_all=' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35'
584584 # As many question marks as there are digits in the last test group number.
585585 # Used to normalize the test group numbers so that `ls' lists them in
586586 # numerical order.
@@ -613,12 +613,13 @@
614614 26;testsuite.at:182;list1;;
615615 27;testsuite.at:189;list2;;
616616 28;testsuite.at:196;list3;;
617 -29;testsuite.at:203;hr;;
618 -30;testsuite.at:210;link1;;
619 -31;testsuite.at:218;link2;;
620 -32;testsuite.at:225;link3;;
621 -33;testsuite.at:232;link4;;
622 -34;testsuite.at:239;link5;;
 617+29;testsuite.at:203;list4;;
 618+30;testsuite.at:210;hr;;
 619+31;testsuite.at:217;link1;;
 620+32;testsuite.at:225;link2;;
 621+33;testsuite.at:232;link3;;
 622+34;testsuite.at:239;link4;;
 623+35;testsuite.at:246;link5;;
623624 "
624625
625626 # at_fn_validate_ranges NAME...
@@ -630,7 +631,7 @@
631632 for at_grp
632633 do
633634 eval at_value=\$$at_grp
634 - if test $at_value -lt 1 || test $at_value -gt 34; then
 635+ if test $at_value -lt 1 || test $at_value -gt 35; then
635636 $as_echo "invalid test group: $at_value" >&2
636637 exit 1
637638 fi
@@ -2982,11 +2983,11 @@
29832984 read at_status <"$at_status_file"
29842985 #AT_STOP_28
29852986 #AT_START_29
2986 -# 29. testsuite.at:203: hr
 2987+# 29. testsuite.at:203: list4
29872988 at_setup_line='testsuite.at:203'
29882989 at_fn_banner 1
2989 -at_desc="hr"
2990 -at_desc_line=" 29: $at_desc "
 2990+at_desc="list4"
 2991+at_desc_line=" 29: $at_desc "
29912992 $at_quiet $as_echo_n "$at_desc_line"
29922993 at_xfail=no
29932994 echo "# -*- compilation -*-" >> "$at_group_log"
@@ -2999,9 +3000,9 @@
30003001 _ATEOF
30013002
30023003 { set +x
3003 -$as_echo "$at_srcdir/testsuite.at:206: testtext \${srcdir}/hr/hr1.in > tempoutput && diff \${srcdir}/hr/hr1.out tempoutput"
 3004+$as_echo "$at_srcdir/testsuite.at:206: testtext \${srcdir}/list/list4.in > tempoutput && diff \${srcdir}/list/list4.out tempoutput"
30043005 at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:206"
3005 -( $at_check_trace; testtext ${srcdir}/hr/hr1.in > tempoutput && diff ${srcdir}/hr/hr1.out tempoutput
 3006+( $at_check_trace; testtext ${srcdir}/list/list4.in > tempoutput && diff ${srcdir}/list/list4.out tempoutput
30063007 ) >>"$at_stdout" 2>>"$at_stderr"
30073008 at_status=$? at_failed=false
30083009 $at_check_filter
@@ -3018,11 +3019,11 @@
30193020 read at_status <"$at_status_file"
30203021 #AT_STOP_29
30213022 #AT_START_30
3022 -# 30. testsuite.at:210: link1
 3023+# 30. testsuite.at:210: hr
30233024 at_setup_line='testsuite.at:210'
30243025 at_fn_banner 1
3025 -at_desc="link1"
3026 -at_desc_line=" 30: $at_desc "
 3026+at_desc="hr"
 3027+at_desc_line=" 30: $at_desc "
30273028 $at_quiet $as_echo_n "$at_desc_line"
30283029 at_xfail=no
30293030 echo "# -*- compilation -*-" >> "$at_group_log"
@@ -3035,9 +3036,9 @@
30363037 _ATEOF
30373038
30383039 { set +x
3039 -$as_echo "$at_srcdir/testsuite.at:213: testtext \${srcdir}/link/link1.in > tempoutput && diff \${srcdir}/link/link1.out tempoutput"
 3040+$as_echo "$at_srcdir/testsuite.at:213: testtext \${srcdir}/hr/hr1.in > tempoutput && diff \${srcdir}/hr/hr1.out tempoutput"
30403041 at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:213"
3041 -( $at_check_trace; testtext ${srcdir}/link/link1.in > tempoutput && diff ${srcdir}/link/link1.out tempoutput
 3042+( $at_check_trace; testtext ${srcdir}/hr/hr1.in > tempoutput && diff ${srcdir}/hr/hr1.out tempoutput
30423043 ) >>"$at_stdout" 2>>"$at_stderr"
30433044 at_status=$? at_failed=false
30443045 $at_check_filter
@@ -3054,16 +3055,16 @@
30553056 read at_status <"$at_status_file"
30563057 #AT_STOP_30
30573058 #AT_START_31
3058 -# 31. testsuite.at:218: link2
3059 -at_setup_line='testsuite.at:218'
 3059+# 31. testsuite.at:217: link1
 3060+at_setup_line='testsuite.at:217'
30603061 at_fn_banner 1
3061 -at_desc="link2"
 3062+at_desc="link1"
30623063 at_desc_line=" 31: $at_desc "
30633064 $at_quiet $as_echo_n "$at_desc_line"
30643065 at_xfail=no
30653066 echo "# -*- compilation -*-" >> "$at_group_log"
30663067 (
3067 - $as_echo "31. testsuite.at:218: testing ..."
 3068+ $as_echo "31. testsuite.at:217: testing ..."
30683069 $at_traceon
30693070
30703071
@@ -3071,15 +3072,15 @@
30723073 _ATEOF
30733074
30743075 { set +x
3075 -$as_echo "$at_srcdir/testsuite.at:221: testtext \${srcdir}/link/link2.in > tempoutput && diff \${srcdir}/link/link2.out tempoutput"
3076 -at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:221"
3077 -( $at_check_trace; testtext ${srcdir}/link/link2.in > tempoutput && diff ${srcdir}/link/link2.out tempoutput
 3076+$as_echo "$at_srcdir/testsuite.at:220: testtext \${srcdir}/link/link1.in > tempoutput && diff \${srcdir}/link/link1.out tempoutput"
 3077+at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:220"
 3078+( $at_check_trace; testtext ${srcdir}/link/link1.in > tempoutput && diff ${srcdir}/link/link1.out tempoutput
30783079 ) >>"$at_stdout" 2>>"$at_stderr"
30793080 at_status=$? at_failed=false
30803081 $at_check_filter
30813082 at_fn_diff_devnull "$at_stderr" || at_failed=:
30823083 at_fn_diff_devnull "$at_stdout" || at_failed=:
3083 -at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:221"
 3084+at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:220"
30843085 $at_failed && at_fn_log_failure
30853086 $at_traceon; }
30863087
@@ -3090,10 +3091,10 @@
30913092 read at_status <"$at_status_file"
30923093 #AT_STOP_31
30933094 #AT_START_32
3094 -# 32. testsuite.at:225: link3
 3095+# 32. testsuite.at:225: link2
30953096 at_setup_line='testsuite.at:225'
30963097 at_fn_banner 1
3097 -at_desc="link3"
 3098+at_desc="link2"
30983099 at_desc_line=" 32: $at_desc "
30993100 $at_quiet $as_echo_n "$at_desc_line"
31003101 at_xfail=no
@@ -3107,9 +3108,9 @@
31083109 _ATEOF
31093110
31103111 { set +x
3111 -$as_echo "$at_srcdir/testsuite.at:228: testtext \${srcdir}/link/link3.in > tempoutput && diff \${srcdir}/link/link3.out tempoutput"
 3112+$as_echo "$at_srcdir/testsuite.at:228: testtext \${srcdir}/link/link2.in > tempoutput && diff \${srcdir}/link/link2.out tempoutput"
31123113 at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:228"
3113 -( $at_check_trace; testtext ${srcdir}/link/link3.in > tempoutput && diff ${srcdir}/link/link3.out tempoutput
 3114+( $at_check_trace; testtext ${srcdir}/link/link2.in > tempoutput && diff ${srcdir}/link/link2.out tempoutput
31143115 ) >>"$at_stdout" 2>>"$at_stderr"
31153116 at_status=$? at_failed=false
31163117 $at_check_filter
@@ -3126,10 +3127,10 @@
31273128 read at_status <"$at_status_file"
31283129 #AT_STOP_32
31293130 #AT_START_33
3130 -# 33. testsuite.at:232: link4
 3131+# 33. testsuite.at:232: link3
31313132 at_setup_line='testsuite.at:232'
31323133 at_fn_banner 1
3133 -at_desc="link4"
 3134+at_desc="link3"
31343135 at_desc_line=" 33: $at_desc "
31353136 $at_quiet $as_echo_n "$at_desc_line"
31363137 at_xfail=no
@@ -3143,9 +3144,9 @@
31443145 _ATEOF
31453146
31463147 { set +x
3147 -$as_echo "$at_srcdir/testsuite.at:235: testtext \${srcdir}/link/link4.in > tempoutput && diff \${srcdir}/link/link4.out tempoutput"
 3148+$as_echo "$at_srcdir/testsuite.at:235: testtext \${srcdir}/link/link3.in > tempoutput && diff \${srcdir}/link/link3.out tempoutput"
31483149 at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:235"
3149 -( $at_check_trace; testtext ${srcdir}/link/link4.in > tempoutput && diff ${srcdir}/link/link4.out tempoutput
 3150+( $at_check_trace; testtext ${srcdir}/link/link3.in > tempoutput && diff ${srcdir}/link/link3.out tempoutput
31503151 ) >>"$at_stdout" 2>>"$at_stderr"
31513152 at_status=$? at_failed=false
31523153 $at_check_filter
@@ -3162,10 +3163,10 @@
31633164 read at_status <"$at_status_file"
31643165 #AT_STOP_33
31653166 #AT_START_34
3166 -# 34. testsuite.at:239: link5
 3167+# 34. testsuite.at:239: link4
31673168 at_setup_line='testsuite.at:239'
31683169 at_fn_banner 1
3169 -at_desc="link5"
 3170+at_desc="link4"
31703171 at_desc_line=" 34: $at_desc "
31713172 $at_quiet $as_echo_n "$at_desc_line"
31723173 at_xfail=no
@@ -3179,9 +3180,9 @@
31803181 _ATEOF
31813182
31823183 { set +x
3183 -$as_echo "$at_srcdir/testsuite.at:242: testtext \${srcdir}/link/link5.in > tempoutput && diff \${srcdir}/link/link5.out tempoutput"
 3184+$as_echo "$at_srcdir/testsuite.at:242: testtext \${srcdir}/link/link4.in > tempoutput && diff \${srcdir}/link/link4.out tempoutput"
31843185 at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:242"
3185 -( $at_check_trace; testtext ${srcdir}/link/link5.in > tempoutput && diff ${srcdir}/link/link5.out tempoutput
 3186+( $at_check_trace; testtext ${srcdir}/link/link4.in > tempoutput && diff ${srcdir}/link/link4.out tempoutput
31863187 ) >>"$at_stdout" 2>>"$at_stderr"
31873188 at_status=$? at_failed=false
31883189 $at_check_filter
@@ -3197,3 +3198,39 @@
31983199 ) 5>&1 2>&1 | eval $at_tee_pipe
31993200 read at_status <"$at_status_file"
32003201 #AT_STOP_34
 3202+#AT_START_35
 3203+# 35. testsuite.at:246: link5
 3204+at_setup_line='testsuite.at:246'
 3205+at_fn_banner 1
 3206+at_desc="link5"
 3207+at_desc_line=" 35: $at_desc "
 3208+$at_quiet $as_echo_n "$at_desc_line"
 3209+at_xfail=no
 3210+echo "# -*- compilation -*-" >> "$at_group_log"
 3211+(
 3212+ $as_echo "35. testsuite.at:246: testing ..."
 3213+ $at_traceon
 3214+
 3215+
 3216+cat >tempoutput <<'_ATEOF'
 3217+_ATEOF
 3218+
 3219+{ set +x
 3220+$as_echo "$at_srcdir/testsuite.at:249: testtext \${srcdir}/link/link5.in > tempoutput && diff \${srcdir}/link/link5.out tempoutput"
 3221+at_fn_check_prepare_notrace 'a ${...} parameter expansion' "testsuite.at:249"
 3222+( $at_check_trace; testtext ${srcdir}/link/link5.in > tempoutput && diff ${srcdir}/link/link5.out tempoutput
 3223+) >>"$at_stdout" 2>>"$at_stderr"
 3224+at_status=$? at_failed=false
 3225+$at_check_filter
 3226+at_fn_diff_devnull "$at_stderr" || at_failed=:
 3227+at_fn_diff_devnull "$at_stdout" || at_failed=:
 3228+at_fn_check_status 0 $at_status "$at_srcdir/testsuite.at:249"
 3229+$at_failed && at_fn_log_failure
 3230+$at_traceon; }
 3231+
 3232+
 3233+ set +x
 3234+ $at_times_p && times >"$at_times_file"
 3235+) 5>&1 2>&1 | eval $at_tee_pipe
 3236+read at_status <"$at_status_file"
 3237+#AT_STOP_35
Index: trunk/parsers/libmwparser/tests/testsuite.at
@@ -200,6 +200,13 @@
201201
202202 AT_CLEANUP
203203
 204+AT_SETUP([list4])
 205+
 206+AT_DATA([tempoutput], [])
 207+AT_CHECK([testtext ${srcdir}/list/list4.in > tempoutput && diff ${srcdir}/list/list4.out tempoutput])
 208+
 209+AT_CLEANUP
 210+
204211 AT_SETUP([hr])
205212
206213 AT_DATA([tempoutput], [])
Index: trunk/parsers/libmwparser/tests/list/list1.out
@@ -12,6 +12,8 @@
1313 WORD[item]
1414 END BULLET LIST ITEM
1515 END BULLET LIST
 16+ END BULLET LIST ITEM
 17+ BEGIN BULLET LIST ITEM
1618 WORD[bar]
1719 BEGIN ENUMERATION LIST
1820 BEGIN ENUMERATION LIST ITEM
Index: trunk/parsers/libmwparser/tests/list/list4.in
@@ -0,0 +1,4 @@
 2+* list
 3+*# subitem
 4+*# subitem
 5+* list continuation
Index: trunk/parsers/libmwparser/tests/list/list4.out
@@ -0,0 +1,20 @@
 2+BEGIN ARTICLE
 3+ BEGIN BULLET LIST
 4+ BEGIN BULLET LIST ITEM
 5+ WORD[list]
 6+ BEGIN ENUMERATION LIST
 7+ BEGIN ENUMERATION LIST ITEM
 8+ WORD[subitem]
 9+ END ENUMERATION LIST ITEM
 10+ BEGIN ENUMERATION LIST ITEM
 11+ WORD[subitem]
 12+ END ENUMERATION LIST ITEM
 13+ END ENUMERATION LIST
 14+ END BULLET LIST ITEM
 15+ BEGIN BULLET LIST ITEM
 16+ WORD[list]
 17+ SPACE[ ]
 18+ WORD[continuation]
 19+ END BULLET LIST ITEM
 20+ END BULLET LIST
 21+END ARTICLE

Status & tagging log