Overview
Comment: | s_expressions-parsers-tests: add a test for the new Lockable interface of Subparser objects |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e1b283ce5a9f79ffb323645b273c2d91 |
User & Date: | nat on 2014-03-06 17:23:09 |
Other Links: | manifest | tags |
Context
2014-03-07
| ||
21:53 | s_expressions-generic_caches: implement Lockable.Descriptor interface on memory caches check-in: 660d5d43a4 user: nat tags: trunk | |
2014-03-06
| ||
17:23 | s_expressions-parsers-tests: add a test for the new Lockable interface of Subparser objects check-in: e1b283ce5a user: nat tags: trunk | |
2014-03-05
| ||
21:22 | s_expressions-parsers: implement the new Lockable.Descriptor interface on Subparser objects check-in: d6970f2d05 user: nat tags: trunk | |
Changes
Modified tests/natools-s_expressions-parsers-tests.adb from [f6937be6c8] to [e5f07b4bc7].
︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | + | -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Natools.S_Expressions.Lockable.Tests; with Natools.S_Expressions.Printers; with Natools.S_Expressions.Test_Tools; package body Natools.S_Expressions.Parsers.Tests is procedure Check_Parsing (Report : in out NT.Reporter'Class; |
︙ | |||
119 120 121 122 123 124 125 126 127 128 129 130 131 132 | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | + | Base64_Subexpression (Report); Special_Subexpression (Report); Nested_Subpexression (Report); Number_Prefixes (Report); Quoted_Escapes (Report); Parser_Interface (Report); Subparser_Interface (Report); Lockable_Interface (Report); end All_Tests; ----------------------- -- Inidividual Tests -- ----------------------- |
︙ | |||
167 168 169 170 171 172 173 174 175 176 177 178 179 180 | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | + + + + + + + + + + + + + + + + + | (Name => "Base-64 subexpression", Source => To_Atom ("head({KDc6c3VibGlzdCk1OnRva2Vu})""tail"""), Expected => To_Atom ("4:head((7:sublist)5:token)4:tail")); begin Test (Report); end Base64_Subexpression; procedure Lockable_Interface (Report : in out NT.Reporter'Class) is Test : NT.Test := Report.Item ("Lockable.Descriptor interface"); begin declare Input : aliased Test_Tools.Memory_Stream; Parser : aliased Parsers.Parser; Sub : Subparser (Parser'Access, Input'Access); begin Input.Set_Data (Lockable.Tests.Test_Expression); Test_Tools.Next_And_Check (Test, Sub, Events.Open_List, 1); Lockable.Tests.Test_Interface (Test, Sub); end; exception when Error : others => Test.Report_Exception (Error); end Lockable_Interface; procedure Nested_Subpexression (Report : in out NT.Reporter'Class) is procedure Test is new Blackbox_Test (Name => "Nested base-64 subepxressions", Source => To_Atom ("(5:begin" & "{KG5lc3RlZCB7S0dSbFpYQWdjR0Y1Ykc5aFpDaz19KQ==}" & "end)"), |
︙ | |||
439 440 441 442 443 444 445 | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | - - - - + + + + | pragma Assert (Parser.Current_Event = Events.Open_List); Parser.Next_Event (Input'Access); pragma Assert (Parser.Current_Event = Events.Add_Atom and then Parser.Current_Atom = To_Atom ("command")); -- Use subparser as command arguments |
︙ | |||
475 476 477 478 479 480 481 | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | - + - + - + - + - + | "Parser last atom"); end if; -- Check subparser error states if Sub.Current_Event /= Events.End_Of_Input then Test.Fail ("Unexpected subparser final state: " |
︙ | |||
537 538 539 540 541 542 543 | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | - + | Test.Fail ("No exception raised in Query_Atom on finished subparser"); if Called then Test_Tools.Dump_Atom (Test, Output.Get_Data, "Process called with"); end if; exception |
︙ |
Modified tests/natools-s_expressions-parsers-tests.ads from [6b1fcfc480] to [12f71ec222].
︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | + | package NT renames Natools.Tests; procedure All_Tests (Report : in out NT.Reporter'Class); procedure Atom_Encodings (Report : in out NT.Reporter'Class); procedure Base64_Subexpression (Report : in out NT.Reporter'Class); procedure Canonical_Encoding (Report : in out NT.Reporter'Class); procedure Lockable_Interface (Report : in out NT.Reporter'Class); procedure Nested_Subpexression (Report : in out NT.Reporter'Class); procedure Number_Prefixes (Report : in out NT.Reporter'Class); procedure Parser_Interface (Report : in out NT.Reporter'Class); procedure Quoted_Escapes (Report : in out NT.Reporter'Class); procedure Special_Subexpression (Report : in out NT.Reporter'Class); procedure Subparser_Interface (Report : in out NT.Reporter'Class); end Natools.S_Expressions.Parsers.Tests; |