r14580 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14579‎ | r14580 | r14581 >
Date:20:36, 5 June 2006
Author:brion
Status:old
Tags:
Comment:
Add some basic regression tests on extraction for section editing
Modified paths:
  • /trunk/phase3/maintenance/parserTests.inc (modified) (history)
  • /trunk/phase3/maintenance/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.inc
@@ -269,6 +269,9 @@
270270 $out = $parser->preSaveTransform( $input, $title, $user, $options );
271271 } elseif (preg_match('/\\bmsg\\b/i', $opts)) {
272272 $out = $parser->transformMsg( $input, $options );
 273+ } elseif( preg_match( '/\\bsection=(\d+)\b/', $opts, $matches ) ) {
 274+ $section = intval( $matches[1] );
 275+ $out = Article::getSection( $input, $section );
273276 } else {
274277 $output = $parser->parse( $input, $title, $options, true, true, 1337 );
275278 $out = $output->getText();
Index: trunk/phase3/maintenance/parserTests.txt
@@ -4424,6 +4424,246 @@
44254425
44264426 !! end
44274427
 4428+!! test
 4429+Invalid header with following text
 4430+!! input
 4431+= x = y
 4432+!! result
 4433+<p>= x = y
 4434+</p>
 4435+!! end
 4436+
 4437+
 4438+!! test
 4439+Section extraction test (section 0)
 4440+!! options
 4441+section=0
 4442+!! input
 4443+start
 4444+==a==
 4445+===aa===
 4446+====aaa====
 4447+==b==
 4448+===ba===
 4449+===bb===
 4450+====bba====
 4451+===bc===
 4452+==c==
 4453+===ca===
 4454+!! result
 4455+start
 4456+!! end
 4457+
 4458+!! test
 4459+Section extraction test (section 1)
 4460+!! options
 4461+section=1
 4462+!! input
 4463+start
 4464+==a==
 4465+===aa===
 4466+====aaa====
 4467+==b==
 4468+===ba===
 4469+===bb===
 4470+====bba====
 4471+===bc===
 4472+==c==
 4473+===ca===
 4474+!! result
 4475+==a==
 4476+===aa===
 4477+====aaa====
 4478+!! end
 4479+
 4480+!! test
 4481+Section extraction test (section 2)
 4482+!! options
 4483+section=2
 4484+!! input
 4485+start
 4486+==a==
 4487+===aa===
 4488+====aaa====
 4489+==b==
 4490+===ba===
 4491+===bb===
 4492+====bba====
 4493+===bc===
 4494+==c==
 4495+===ca===
 4496+!! result
 4497+===aa===
 4498+====aaa====
 4499+!! end
 4500+
 4501+!! test
 4502+Section extraction test (section 3)
 4503+!! options
 4504+section=3
 4505+!! input
 4506+start
 4507+==a==
 4508+===aa===
 4509+====aaa====
 4510+==b==
 4511+===ba===
 4512+===bb===
 4513+====bba====
 4514+===bc===
 4515+==c==
 4516+===ca===
 4517+!! result
 4518+====aaa====
 4519+!! end
 4520+
 4521+!! test
 4522+Section extraction test (section 4)
 4523+!! options
 4524+section=4
 4525+!! input
 4526+start
 4527+==a==
 4528+===aa===
 4529+====aaa====
 4530+==b==
 4531+===ba===
 4532+===bb===
 4533+====bba====
 4534+===bc===
 4535+==c==
 4536+===ca===
 4537+!! result
 4538+==b==
 4539+===ba===
 4540+===bb===
 4541+====bba====
 4542+===bc===
 4543+!! end
 4544+
 4545+!! test
 4546+Section extraction test (section 5)
 4547+!! options
 4548+section=5
 4549+!! input
 4550+start
 4551+==a==
 4552+===aa===
 4553+====aaa====
 4554+==b==
 4555+===ba===
 4556+===bb===
 4557+====bba====
 4558+===bc===
 4559+==c==
 4560+===ca===
 4561+!! result
 4562+===ba===
 4563+!! end
 4564+
 4565+!! test
 4566+Section extraction test (section 6)
 4567+!! options
 4568+section=6
 4569+!! input
 4570+start
 4571+==a==
 4572+===aa===
 4573+====aaa====
 4574+==b==
 4575+===ba===
 4576+===bb===
 4577+====bba====
 4578+===bc===
 4579+==c==
 4580+===ca===
 4581+!! result
 4582+===bb===
 4583+====bba====
 4584+!! end
 4585+
 4586+!! test
 4587+Section extraction test (section 7)
 4588+!! options
 4589+section=7
 4590+!! input
 4591+start
 4592+==a==
 4593+===aa===
 4594+====aaa====
 4595+==b==
 4596+===ba===
 4597+===bb===
 4598+====bba====
 4599+===bc===
 4600+==c==
 4601+===ca===
 4602+!! result
 4603+====bba====
 4604+!! end
 4605+
 4606+!! test
 4607+Section extraction test (section 8)
 4608+!! options
 4609+section=8
 4610+!! input
 4611+start
 4612+==a==
 4613+===aa===
 4614+====aaa====
 4615+==b==
 4616+===ba===
 4617+===bb===
 4618+====bba====
 4619+===bc===
 4620+==c==
 4621+===ca===
 4622+!! result
 4623+===bc===
 4624+!! end
 4625+
 4626+!! test
 4627+Section extraction test (section 9)
 4628+!! options
 4629+section=9
 4630+!! input
 4631+start
 4632+==a==
 4633+===aa===
 4634+====aaa====
 4635+==b==
 4636+===ba===
 4637+===bb===
 4638+====bba====
 4639+===bc===
 4640+==c==
 4641+===ca===
 4642+!! result
 4643+==c==
 4644+===ca===
 4645+!! end
 4646+
 4647+!! test
 4648+Section extraction test (section 10)
 4649+!! options
 4650+section=10
 4651+!! input
 4652+start
 4653+==a==
 4654+===aa===
 4655+====aaa====
 4656+==b==
 4657+===ba===
 4658+===bb===
 4659+====bba====
 4660+===bc===
 4661+==c==
 4662+===ca===
 4663+!! result
 4664+===ca===
 4665+!! end
 4666+
 4667+
44284668 #
44294669 #
44304670 #

Status & tagging log