RegressionTests__XPathTests.st
author Claus Gittinger <cg@exept.de>
Tue, 25 Feb 2020 17:19:49 +0100
changeset 2586 7dc7be5a6f3d
parent 2485 20030382232b
permissions -rw-r--r--
#OTHER by cg s
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2037
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
     1
"{ Encoding: utf8 }"
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
     2
2485
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
     3
"
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
     4
 COPYRIGHT (c) 2018 by eXept Software AG
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
     5
              All Rights Reserved
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
     6
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
     7
 This software is furnished under a license and may be used
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
     8
 only in accordance with the terms of that license and with the
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    10
 be provided or otherwise made available to, or used by, any
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    11
 other person.  No title to or ownership of the software is
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    12
 hereby transferred.
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    13
"
2010
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
"{ Package: 'stx:goodies/regression' }"
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
"{ NameSpace: RegressionTests }"
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
TestCase subclass:#XPathTests
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	instanceVariableNames:''
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	classVariableNames:''
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	poolDictionaries:''
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	category:'tests-Regression-XML'
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
!XPathTests class methodsFor:'documentation'!
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
2485
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    27
copyright
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    28
"
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    29
 COPYRIGHT (c) 2018 by eXept Software AG
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    30
              All Rights Reserved
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    31
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    32
 This software is furnished under a license and may be used
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    33
 only in accordance with the terms of that license and with the
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    35
 be provided or otherwise made available to, or used by, any
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    36
 other person.  No title to or ownership of the software is
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    37
 hereby transferred.
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    38
"
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    39
!
20030382232b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2252
diff changeset
    40
2010
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
documentation
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
"
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    documentation to be added.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    [author:]
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
        Claus Gittinger
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    [instance variables:]
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
    [class variables:]
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    [see also:]
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
"
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
! !
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
2252
81d1e190c613 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
    57
!XPathTests class methodsFor:'queries'!
81d1e190c613 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
    58
81d1e190c613 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
    59
requiredPackageNames
81d1e190c613 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
    60
    ^ #('stx:goodies/xml/xpath')
81d1e190c613 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
    61
81d1e190c613 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
    62
    "Created: / 29-05-2019 / 01:36:02 / Claus Gittinger"
81d1e190c613 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
    63
! !
81d1e190c613 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
    64
2010
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
!XPathTests methodsFor:'tests'!
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
test01
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    |node child|
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    "/                              123456789012
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    node := XML::XPathParser parse:'/foo/bar/baz'.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    self assert:(node condensedPrintString = '/foo/bar/baz').
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    self assert:(node startPosition == 1).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    self assert:(node endPosition == 1).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    self assert:(node isXPathRoot).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    child := node child.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    self assert:(child startPosition == 2).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    "/ self assert:(child endPosition == 4).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
    child := child child.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
    self assert:(child startPosition == 6).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    "/ self assert:(child endPosition == 8).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    child := child child.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    self assert:(child startPosition == 10).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
    "/ self assert:(child endPosition == 12).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    "/                              123456789012
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
    node := XML::XPathParser parse:'/foo/../baz'.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    self assert:(node condensedPrintString = '/foo/../baz').
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    self assert:(node startPosition == 1).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
    self assert:(node endPosition == 1).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    self assert:(node isXPathRoot).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    child := node child.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    self assert:(child startPosition == 2).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    "/ self assert:(child endPosition == 4).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
    child := child child.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
    self assert:(child startPosition == 6).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
    "/ self assert:(child endPosition == 7).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
    child := child child.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
    self assert:(child startPosition == 9).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
    "/ self assert:(child endPosition == 11).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
    "/                              123456789012
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
    node := XML::XPathParser parse:'/foo[1]/baz'.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
    self assert:(node condensedPrintString = '/foo[1]/baz').
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
    self assert:(node startPosition == 1).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
    self assert:(node endPosition == 1).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
    self assert:(node isXPathRoot).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
    child := node child.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
    self assert:(child startPosition == 2).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
    "/ self assert:(child endPosition == 4).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
    child := child child.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
    self assert:(child startPosition == 9).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
    "/ self assert:(child endPosition == 11).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    "/                              1234567890123456789
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
    node := XML::XPathParser parse:'/foo[@name="bla"]/baz'.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
    self assert:(node condensedPrintString = '/foo[@name = "bla"]/baz').
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
    self assert:(node startPosition == 1).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    self assert:(node endPosition == 1).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    self assert:(node isXPathRoot).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    child := node child.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
    self assert:(child startPosition == 2).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
    "/ self assert:(child endPosition == 4).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    child := child child.
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
    self assert:(child startPosition == 19).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
    "/ self assert:(child endPosition == 11).
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
    "
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
     self run:#test01
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
     self new test01
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
    "
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
    "Created: / 24-09-2018 / 20:17:35 / Claus Gittinger"
2037
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   148
!
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   149
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   150
test02
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   151
    |node child dom nodeContext matchingDomNode|
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   152
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   153
    "/                                       1         2         3   
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   154
    "/                              1234567890123456789012345678901234567890
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   155
    node := XML::XPathParser parse:'/child::foo/child::bar/child::baz'.
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   156
    self assert:(node condensedPrintString = '/foo/bar/baz').
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   157
    self assert:(node printString = '/child::foo/child::bar/child::baz').
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   158
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   159
    self assert:(node startPosition == 1).
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   160
    self assert:(node endPosition == 1).
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   161
    self assert:(node isXPathRoot).
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   162
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   163
    child := node child.
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   164
    self assert:(child startPosition == 2).
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   165
    "/ self assert:(child endPosition == 4).
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   166
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   167
    child := child child.
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   168
    self assert:(child startPosition == 13).
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   169
    "/ self assert:(child endPosition == 8).
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   170
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   171
    child := child child.
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   172
    self assert:(child startPosition == 24).
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   173
    "/ self assert:(child endPosition == 12).
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   174
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   175
    dom := XML::XMLParser parse:'
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   176
<foo>
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   177
  <bar>
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   178
    <baz>
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   179
      text
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   180
    </baz>
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   181
  </bar>
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   182
</foo>
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   183
'.
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   184
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   185
    nodeContext := node xpathValueFor:dom variables:#().
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   186
    self assert:(nodeContext unsortedNodes size == 1).
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   187
    matchingDomNode := nodeContext unsortedNodes first.
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   188
    self assert:(matchingDomNode tag type = 'baz').
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   189
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   190
    dom := XML::XMLParser parse:'
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   191
<foo>
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   192
  <bar>
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   193
    <baz>
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   194
      text1
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   195
    </baz>
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   196
    <baz>
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   197
      text2
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   198
    </baz>
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   199
  </bar>
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   200
</foo>
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   201
'.
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   202
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   203
    nodeContext := node xpathValueFor:dom variables:#().
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   204
    self assert:(nodeContext unsortedNodes size == 2).
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   205
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   206
    "
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   207
     self run:#test02
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   208
     self new test02
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   209
    "
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   210
586818cf9da9 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 2010
diff changeset
   211
    "Created: / 25-09-2018 / 23:47:18 / Claus Gittinger"
2010
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
! !
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
!XPathTests class methodsFor:'documentation'!
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
version_CVS
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
    ^ '$Header$'
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
! !
5c9cbd188acc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219