Wrong adding new line characters to the expected result

14 views
Skip to first unread message

ol sp

unread,
Dec 13, 2022, 5:59:20 AM12/13/22
to XSpec
I have a scenario where I need to test that nothing was changed. So I reference in contect@select and expect@select to the same element. 

 <x:scenario label="Scenario for testing template with match 'tuplet'">
    <x:scenario label="@num.visible preserved">
      <x:param href="input/input_4.xml" name="global-context-item"/>
      <x:context mode="enable.tuplet.nums" select="$global-context-item/id('dir_22245')"/>
      <x:expect label="supplied with content will be preserved." select="$global-context-item/id('dir_22245')"/>
    </x:scenario>  
  </x:scenario>

The test fails because new lines are added (screenshot).

I use oXygen XML Editor 25.0 and Xspec framework v2.2.6

Screenshot_1.png

AirQuick

unread,
Dec 13, 2022, 9:01:36 AM12/13/22
to xspec...@googlegroups.com
input_4.xml seems to be indented. In other words, it seems to have whitespace-only text nodes between elements.
Since x:param/@href keeps whitespace-only text nodes intact, $global-context-item has whitespace-only text nodes as they are in input_4.xml. In the expected result (right side) in your screenshot, "\n..." represents those whitespace-only text nodes.

I don't know what your mode="enable.tuplet.nums" is doing, but I guess it's implicitly or explicitly discarding whitespace-only text nodes inside <dir>. The actual result (left side) in your screenshot has no whitespace-only text nodes represented by "\n...".

When XSpec compares the actual result and the expected result, all nodes are considered as significant. Whitespace-only text nodes are not ignored. Your actual result has no whitespace-only text nodes, but your expected result has some. XSpec compared them, found them different and declared Failure.

For more details about whitespace-only text nodes, see https://github.com/xspec/xspec/wiki/Whitespace-only-Text-Nodes


Hope this helps,
AirQuick
Screenshot_1.png
Reply all
Reply to author
Forward
0 new messages