Simple document tests. @author BaseX Team, BSD License @author Christian Gruen
| 9 | * @author Christian Gruen |
| 10 | */ |
| 11 | public final class DocTest extends QueryTest { |
| 12 | static { |
| 13 | create(""" |
| 14 | <?xml version='1.0' encoding='iso-8859-1'?> |
| 15 | <html> |
| 16 | <!-- Header --> |
| 17 | <head id='0'> |
| 18 | <title>XML</title> |
| 19 | </head> |
| 20 | <!-- Body --> |
| 21 | <body id='1' bgcolor='#FFFFFF' text='#000000' link='#0000CC'> |
| 22 | <h1>Databases & XML</h1> |
| 23 | <div align = 'right' > |
| 24 | <b>Assignments</b> |
| 25 | <ul> |
| 26 | <li>Exercise 1</li> |
| 27 | <li>Exercise 2</li> |
| 28 | </ul> |
| 29 | </div> |
| 30 | </body> |
| 31 | <?pi bogus?> |
| 32 | </html>"""); |
| 33 | |
| 34 | queries = new Object[][] { |
| 35 | { "Root 1", nodes(0), "/" }, |
| 36 | { "Root 2", nodes(0), "/." }, |
| 37 | { "Root 3", nodes(1), "/*" }, |
| 38 | { "Root 4", nodes(1), "/node()" }, |
| 39 | |
| 40 | { "Child 1", nodes(1), "*" }, |
| 41 | { "Child 2", nodes(1), "node()" }, |
| 42 | { "Child 3", nodes(2, 3, 7, 8, 24), "node()/node()" }, |
| 43 | { "Child 4", nodes(17, 19), "/*/*/*/*" }, |
| 44 | { "Child 5", nodes(0), "./." }, |
| 45 | { "Child 6", nodes(24), "node()/node()[last()]" }, |
| 46 | { "Child Error 1", "./" }, |
| 47 | { "Child Error 2", "html/" }, |
| 48 | |
| 49 | // should only return each element once, see GH-1001 |
| 50 | { "Parent 1", nodes(13, 15), "/html/body/*/../*" }, |
| 51 | { "Parent 2", nodes(20, 22), "//li/parent::ul/li" }, |
| 52 | { "Following 1", nodes(3, 7, 8, 24), "/*/node()/following-sibling::node()" }, |
| 53 | { "Following-Sibling 1", nodes(20, 22), "/*/node()/following::li" }, |
| 54 | |
| 55 | { "Desc 1", nodes(20, 22), "//li" }, |
| 56 | { "Desc 2", nodes(20, 22), "//ul/li" }, |
| 57 | { "Desc 3", nodes(20, 22), "//ul//li" }, |
| 58 | { "Desc 4", nodes(17, 19, 20, 22), "//*//*//*//*" }, |
| 59 | { "Desc 5", nodes(1, 2, 3, 5, 6, 7, 8, 13, 14, 15, 17, 18, 19, 20, 21, |
| 60 | 22, 23, 24), "//node()" }, |
| 61 | { "Desc 6", nodes(0, 1, 2, 3, 5, 6, 7, 8, 13, 14, 15, 17, 18, 19, 20, |
| 62 | 21, 22, 23, 24), ".//." }, |
| 63 | { "Desc 7", nodes(20, 22), ".//li" }, |
| 64 | { "Desc 8", nodes(23), "/descendant-or-self::*[last()]/text()" }, |
| 65 | { "Desc 9", nodes(23), "/descendant::*[last()]/text()" }, |
| 66 | { "Desc Error 1", "//" }, |
| 67 | { "Desc Error 2", "///" }, |
| 68 |
nothing calls this directly
no test coverage detected