Closed jf-tech closed 4 years ago
@zhengchun is the build failure something related to how your travis CI is set up?
https://travis-ci.org/github/antchfx/xmlquery/jobs/719824765
$ $HOME/gopath/bin/goveralls -service=travis-ci
exit status 1: # github.com/antchfx/xmlquery
node_test.go:10:2: cannot find package "github.com/bradleyjkemp/cupaloy" in any of:
/home/travis/.gimme/versions/go1.9.7.linux.amd64/src/github.com/bradleyjkemp/cupaloy (from $GOROOT)
/home/travis/gopath/src/github.com/bradleyjkemp/cupaloy (from $GOPATH)
FAIL github.com/antchfx/xmlquery [setup failed]
Tried a bunch of things, still no luck. Seems 1.9x env go get
doesn't support version tag:
go get github.com/bradleyjkemp/cupaloy@v2.3.0
not supported, so go get
command in .travis.yml
always gets the latest version. The problem is latest version of testify
(v1.6.1) contains code features not available in golang 1.9x
All right, @zhengchun , I gave up. I'll not use testify so go1.9x is still working. However, I think you might consider doing a survey and considering dropping go 1.9 support.
@jf-tech , Sorry, testing failed on my machine, My Go version is v1.14.2, I am not familiar with cupaloy
package, I had tried set UPDATE_SNAPSHOTS=true
but go test
still failed.
@jf-tech , Sorry, testing failed on my machine, My Go version is v1.14.2, I am not familiar with
cupaloy
package, I had tried setUPDATE_SNAPSHOTS=true
butgo test
still failed.
Can you cut&paste your test error msg? No you shouldn't need to use UPDATE_SNAPSHOTS=true
that's only needed when there is an actual update to the snapshot. This is my machine with go1.14.2:
$ go version
go version go1.14.2 darwin/amd64
$ go test ./...
go: downloading golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc
go: downloading github.com/antchfx/xpath v1.1.10
go: downloading github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e
go: downloading golang.org/x/text v0.3.0
go: downloading github.com/bradleyjkemp/cupaloy v2.3.0+incompatible
go: downloading github.com/davecgh/go-spew v1.1.0
go: downloading github.com/pmezard/go-difflib v1.0.0
ok github.com/antchfx/xmlquery 0.394s
$
I not see the error message about which caused problem, the output is all the below message:
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "ggg",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 2,
+ "#children": []
+ }
+ ]
+ }
+ ]
+}
+
FAIL
exit status 1
FAIL github.com/antchfx/xmlquery 9.644s
It is a lot of similar message in my output windows.
Wait, is your machine Windows or Mac OS? Which repo and branch you checked out and git fetched? Do you see a dir named .snapshots
:
$ ls -lah
total 84K
drwxr-xr-x 17 staff 544 Aug 22 10:37 ./
drwxr-xr-x 7 staff 224 Aug 19 09:24 ../
drwxr-xr-x 16 staff 512 Aug 22 10:49 .git/
drwxr-xr-x 7 staff 224 Aug 21 16:21 .snapshots/
-rw-r--r-- 1 staff 306 Aug 19 09:24 .gitignore
-rw-r--r-- 1 staff 317 Aug 22 10:07 .travis.yml
-rw-r--r-- 1 staff 1022 Aug 19 09:24 LICENSE
-rw-r--r-- 1 staff 5.8K Aug 19 09:24 README.md
-rw-r--r-- 1 staff 4.4K Aug 19 09:24 books.xml
-rw-r--r-- 1 staff 914 Aug 19 09:24 cache.go
-rw-r--r-- 1 staff 359 Aug 22 10:37 go.mod
-rw-r--r-- 1 staff 2.0K Aug 22 10:37 go.sum
-rw-r--r-- 1 staff 3.1K Aug 22 10:45 marshal_test.go
-rw-r--r-- 1 staff 8.4K Aug 21 15:48 node.go
-rw-r--r-- 1 staff 16K Aug 22 10:37 node_test.go
-rw-r--r-- 1 staff 6.4K Aug 19 09:24 query.go
-rw-r--r-- 1 staff 3.5K Aug 19 09:24 query_test.go
The .snapshots
dir should have these files:
├── .snapshots
│ ├── TestRemove-remove_a_node_that_is_neither_the_first_nor__the_last_child_of_its_parent
│ ├── TestRemove-remove_a_node_that_is_the_first_but_not_the_last_child_of_its_parent
│ ├── TestRemove-remove_a_node_that_is_the_last_but_not_the_first_child_of_its_parent
│ ├── TestRemove-remove_a_node_that_is_the_only_child_of_its_parent
│ └── TestRemove-remove_on_a_root_does_nothing
I am using windows 10, I had the .snapshots
folder in my project root. I checkout this PR #33 (a360535dbd71faadf43887a40222209208443b81) as my branch.
Can u share the full error msg?
--- FAIL: TestRemove (0.01s)
--- FAIL: TestRemove/remove_a_node_that_is_the_only_child_of_its_parent (0.00s)
node_test.go:137: snapshot not equal:
--- Previous
+++ Current
@@ -1,259 +1,259 @@
-{
- "Parent": "ptr:(nil)",
- "FirstChild": "ptr:(DECL 'xml')",
- "LastChild": "ptr:(ELEM aaa)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DocumentNode",
- "Data": "",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 0,
- "#children": [
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DeclarationNode",
- "Data": "xml",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [
- {
- "Name": {
- "Space": "",
- "Local": "version"
- },
- "Value": "1.0"
- },
- {
- "Name": {
- "Space": "",
- "Local": "encoding"
- },
- "Value": "UTF-8"
- }
- ],
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(DECL 'xml')",
- "NextSibling": "ptr:(DECL 'xml-stylesheet')",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DeclarationNode",
- "Data": "xml-stylesheet",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [
- {
- "Name": {
- "Space": "",
- "Local": "type"
- },
- "Value": "text/xsl"
- },
- {
- "Name": {
- "Space": "",
- "Local": "href"
- },
- "Value": "style.xsl"
- }
- ],
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(DECL 'xml-stylesheet')",
- "NextSibling": "ptr:(COMMENT ' root comment here')",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "CommentNode",
- "Data": " root comment here",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(COMMENT ' root comment here')",
- "NextSibling": "ptr:(ELEM aaa)",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(ELEM bbb)",
- "LastChild": "ptr:(ELEM ggg)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "aaa",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 1,
- "#children": [
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
- "LastChild": "ptr:(CDATA '\n\t\t\t')",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(CDATA '\n\t\t\t')",
- "Type": "ElementNode",
- "Data": "bbb",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 2,
- "#children": [
- {
- "Parent": "ptr:(ELEM bbb)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(ELEM ccc)",
- "Type": "CharDataNode",
- "Data": "\n\t\t\t\tbbb child text\n\t\t\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 3,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM bbb)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t\t')",
- "Type": "ElementNode",
- "Data": "ccc",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 3,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM bbb)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(ELEM ccc)",
- "NextSibling": "ptr:(nil)",
- "Type": "CharDataNode",
- "Data": "\n\t\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 3,
- "#children": []
- }
- ]
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(ELEM bbb)",
- "NextSibling": "ptr:(ELEM ddd)",
- "Type": "CharDataNode",
- "Data": "\n\t\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 2,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "ElementNode",
- "Data": "ddd",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 2,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(ELEM ddd)",
- "NextSibling": "ptr:(ELEM ggg)",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 2,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "ggg",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 2,
- "#children": []
- }
- ]
- }
- ]
-}
-
+{
+ "Parent": "ptr:(nil)",
+ "FirstChild": "ptr:(DECL 'xml')",
+ "LastChild": "ptr:(ELEM aaa)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DocumentNode",
+ "Data": "",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 0,
+ "#children": [
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DeclarationNode",
+ "Data": "xml",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [
+ {
+ "Name": {
+ "Space": "",
+ "Local": "version"
+ },
+ "Value": "1.0"
+ },
+ {
+ "Name": {
+ "Space": "",
+ "Local": "encoding"
+ },
+ "Value": "UTF-8"
+ }
+ ],
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(DECL 'xml')",
+ "NextSibling": "ptr:(DECL 'xml-stylesheet')",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DeclarationNode",
+ "Data": "xml-stylesheet",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [
+ {
+ "Name": {
+ "Space": "",
+ "Local": "type"
+ },
+ "Value": "text/xsl"
+ },
+ {
+ "Name": {
+ "Space": "",
+ "Local": "href"
+ },
+ "Value": "style.xsl"
+ }
+ ],
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(DECL 'xml-stylesheet')",
+ "NextSibling": "ptr:(COMMENT ' root comment here')",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "CommentNode",
+ "Data": " root comment here",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(COMMENT ' root comment here')",
+ "NextSibling": "ptr:(ELEM aaa)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(ELEM bbb)",
+ "LastChild": "ptr:(ELEM ggg)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "aaa",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 1,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
+ "LastChild": "ptr:(CDATA '\n\t\t\t')",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(CDATA '\n\t\t\t')",
+ "Type": "ElementNode",
+ "Data": "bbb",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 2,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM bbb)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(ELEM ccc)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t\t\tbbb child text\n\t\t\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 3,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM bbb)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t\t')",
+ "Type": "ElementNode",
+ "Data": "ccc",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 3,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM bbb)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(ELEM ccc)",
+ "NextSibling": "ptr:(nil)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 3,
+ "#children": []
+ }
+ ]
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(ELEM bbb)",
+ "NextSibling": "ptr:(ELEM ddd)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 2,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "ElementNode",
+ "Data": "ddd",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 2,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(ELEM ddd)",
+ "NextSibling": "ptr:(ELEM ggg)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 2,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "ggg",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 2,
+ "#children": []
+ }
+ ]
+ }
+ ]
+}
+
--- FAIL: TestRemove/remove_a_node_that_is_the_first_but_not_the_last_child_of_its_parent (0.00s)
node_test.go:146: snapshot not equal:
--- Previous
+++ Current
@@ -1,232 +1,232 @@
-{
- "Parent": "ptr:(nil)",
- "FirstChild": "ptr:(DECL 'xml')",
- "LastChild": "ptr:(ELEM aaa)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DocumentNode",
- "Data": "",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 0,
- "#children": [
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DeclarationNode",
- "Data": "xml",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [
- {
- "Name": {
- "Space": "",
- "Local": "version"
- },
- "Value": "1.0"
- },
- {
- "Name": {
- "Space": "",
- "Local": "encoding"
- },
- "Value": "UTF-8"
- }
- ],
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(DECL 'xml')",
- "NextSibling": "ptr:(DECL 'xml-stylesheet')",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DeclarationNode",
- "Data": "xml-stylesheet",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [
- {
- "Name": {
- "Space": "",
- "Local": "type"
- },
- "Value": "text/xsl"
- },
- {
- "Name": {
- "Space": "",
- "Local": "href"
- },
- "Value": "style.xsl"
- }
- ],
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(DECL 'xml-stylesheet')",
- "NextSibling": "ptr:(COMMENT ' root comment here')",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "CommentNode",
- "Data": " root comment here",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(COMMENT ' root comment here')",
- "NextSibling": "ptr:(ELEM aaa)",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(CDATA '\n\t\t\t')",
- "LastChild": "ptr:(ELEM ggg)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "aaa",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 1,
- "#children": [
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(ELEM ddd)",
- "Type": "CharDataNode",
- "Data": "\n\t\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 2,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(ELEM eee)",
- "LastChild": "ptr:(ELEM eee)",
- "PrevSibling": "ptr:(CDATA '\n\t\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "ElementNode",
- "Data": "ddd",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 2,
- "#children": [
- {
- "Parent": "ptr:(ELEM ddd)",
- "FirstChild": "ptr:(ELEM fff)",
- "LastChild": "ptr:(ELEM fff)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "eee",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 3,
- "#children": [
- {
- "Parent": "ptr:(ELEM eee)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "fff",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 4,
- "#children": []
- }
- ]
- }
- ]
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(ELEM ddd)",
- "NextSibling": "ptr:(ELEM ggg)",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 2,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "ggg",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 2,
- "#children": []
- }
- ]
- }
- ]
-}
-
+{
+ "Parent": "ptr:(nil)",
+ "FirstChild": "ptr:(DECL 'xml')",
+ "LastChild": "ptr:(ELEM aaa)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DocumentNode",
+ "Data": "",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 0,
+ "#children": [
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DeclarationNode",
+ "Data": "xml",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [
+ {
+ "Name": {
+ "Space": "",
+ "Local": "version"
+ },
+ "Value": "1.0"
+ },
+ {
+ "Name": {
+ "Space": "",
+ "Local": "encoding"
+ },
+ "Value": "UTF-8"
+ }
+ ],
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(DECL 'xml')",
+ "NextSibling": "ptr:(DECL 'xml-stylesheet')",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DeclarationNode",
+ "Data": "xml-stylesheet",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [
+ {
+ "Name": {
+ "Space": "",
+ "Local": "type"
+ },
+ "Value": "text/xsl"
+ },
+ {
+ "Name": {
+ "Space": "",
+ "Local": "href"
+ },
+ "Value": "style.xsl"
+ }
+ ],
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(DECL 'xml-stylesheet')",
+ "NextSibling": "ptr:(COMMENT ' root comment here')",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "CommentNode",
+ "Data": " root comment here",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(COMMENT ' root comment here')",
+ "NextSibling": "ptr:(ELEM aaa)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(CDATA '\n\t\t\t')",
+ "LastChild": "ptr:(ELEM ggg)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "aaa",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 1,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(ELEM ddd)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 2,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(ELEM eee)",
+ "LastChild": "ptr:(ELEM eee)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "ElementNode",
+ "Data": "ddd",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 2,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM ddd)",
+ "FirstChild": "ptr:(ELEM fff)",
+ "LastChild": "ptr:(ELEM fff)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "eee",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 3,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM eee)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "fff",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 4,
+ "#children": []
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(ELEM ddd)",
+ "NextSibling": "ptr:(ELEM ggg)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 2,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "ggg",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 2,
+ "#children": []
+ }
+ ]
+ }
+ ]
+}
+
--- FAIL: TestRemove/remove_a_node_that_is_neither_the_first_nor__the_last_child_of_its_parent (0.00s)
node_test.go:155: snapshot not equal:
--- Previous
+++ Current
@@ -1,245 +1,245 @@
-{
- "Parent": "ptr:(nil)",
- "FirstChild": "ptr:(DECL 'xml')",
- "LastChild": "ptr:(ELEM aaa)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DocumentNode",
- "Data": "",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 0,
- "#children": [
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DeclarationNode",
- "Data": "xml",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [
- {
- "Name": {
- "Space": "",
- "Local": "version"
- },
- "Value": "1.0"
- },
- {
- "Name": {
- "Space": "",
- "Local": "encoding"
- },
- "Value": "UTF-8"
- }
- ],
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(DECL 'xml')",
- "NextSibling": "ptr:(DECL 'xml-stylesheet')",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DeclarationNode",
- "Data": "xml-stylesheet",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [
- {
- "Name": {
- "Space": "",
- "Local": "type"
- },
- "Value": "text/xsl"
- },
- {
- "Name": {
- "Space": "",
- "Local": "href"
- },
- "Value": "style.xsl"
- }
- ],
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(DECL 'xml-stylesheet')",
- "NextSibling": "ptr:(COMMENT ' root comment here')",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "CommentNode",
- "Data": " root comment here",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(COMMENT ' root comment here')",
- "NextSibling": "ptr:(ELEM aaa)",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(ELEM bbb)",
- "LastChild": "ptr:(ELEM ggg)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "aaa",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 1,
- "#children": [
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
- "LastChild": "ptr:(CDATA '\n\t\t\t')",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(CDATA '\n\t\t\t')",
- "Type": "ElementNode",
- "Data": "bbb",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 2,
- "#children": [
- {
- "Parent": "ptr:(ELEM bbb)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(ELEM ccc)",
- "Type": "CharDataNode",
- "Data": "\n\t\t\t\tbbb child text\n\t\t\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 3,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM bbb)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t\t')",
- "Type": "ElementNode",
- "Data": "ccc",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 3,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM bbb)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(ELEM ccc)",
- "NextSibling": "ptr:(nil)",
- "Type": "CharDataNode",
- "Data": "\n\t\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 3,
- "#children": []
- }
- ]
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(ELEM bbb)",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "CharDataNode",
- "Data": "\n\t\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 2,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t\t')",
- "NextSibling": "ptr:(ELEM ggg)",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 2,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "ggg",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 2,
- "#children": []
- }
- ]
- }
- ]
-}
-
+{
+ "Parent": "ptr:(nil)",
+ "FirstChild": "ptr:(DECL 'xml')",
+ "LastChild": "ptr:(ELEM aaa)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DocumentNode",
+ "Data": "",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 0,
+ "#children": [
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DeclarationNode",
+ "Data": "xml",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [
+ {
+ "Name": {
+ "Space": "",
+ "Local": "version"
+ },
+ "Value": "1.0"
+ },
+ {
+ "Name": {
+ "Space": "",
+ "Local": "encoding"
+ },
+ "Value": "UTF-8"
+ }
+ ],
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(DECL 'xml')",
+ "NextSibling": "ptr:(DECL 'xml-stylesheet')",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DeclarationNode",
+ "Data": "xml-stylesheet",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [
+ {
+ "Name": {
+ "Space": "",
+ "Local": "type"
+ },
+ "Value": "text/xsl"
+ },
+ {
+ "Name": {
+ "Space": "",
+ "Local": "href"
+ },
+ "Value": "style.xsl"
+ }
+ ],
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(DECL 'xml-stylesheet')",
+ "NextSibling": "ptr:(COMMENT ' root comment here')",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "CommentNode",
+ "Data": " root comment here",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(COMMENT ' root comment here')",
+ "NextSibling": "ptr:(ELEM aaa)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(ELEM bbb)",
+ "LastChild": "ptr:(ELEM ggg)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "aaa",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 1,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
+ "LastChild": "ptr:(CDATA '\n\t\t\t')",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(CDATA '\n\t\t\t')",
+ "Type": "ElementNode",
+ "Data": "bbb",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 2,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM bbb)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(ELEM ccc)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t\t\tbbb child text\n\t\t\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 3,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM bbb)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t\t')",
+ "Type": "ElementNode",
+ "Data": "ccc",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 3,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM bbb)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(ELEM ccc)",
+ "NextSibling": "ptr:(nil)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 3,
+ "#children": []
+ }
+ ]
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(ELEM bbb)",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 2,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t\t')",
+ "NextSibling": "ptr:(ELEM ggg)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 2,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "ggg",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 2,
+ "#children": []
+ }
+ ]
+ }
+ ]
+}
+
--- FAIL: TestRemove/remove_a_node_that_is_the_last_but_not_the_first_child_of_its_parent (0.00s)
node_test.go:164: snapshot not equal:
--- Previous
+++ Current
@@ -1,275 +1,275 @@
-{
- "Parent": "ptr:(nil)",
- "FirstChild": "ptr:(DECL 'xml')",
- "LastChild": "ptr:(ELEM aaa)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DocumentNode",
- "Data": "",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 0,
- "#children": [
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DeclarationNode",
- "Data": "xml",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [
- {
- "Name": {
- "Space": "",
- "Local": "version"
- },
- "Value": "1.0"
- },
- {
- "Name": {
- "Space": "",
- "Local": "encoding"
- },
- "Value": "UTF-8"
- }
- ],
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(DECL 'xml')",
- "NextSibling": "ptr:(DECL 'xml-stylesheet')",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DeclarationNode",
- "Data": "xml-stylesheet",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [
- {
- "Name": {
- "Space": "",
- "Local": "type"
- },
- "Value": "text/xsl"
- },
- {
- "Name": {
- "Space": "",
- "Local": "href"
- },
- "Value": "style.xsl"
- }
- ],
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(DECL 'xml-stylesheet')",
- "NextSibling": "ptr:(COMMENT ' root comment here')",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "CommentNode",
- "Data": " root comment here",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(COMMENT ' root comment here')",
- "NextSibling": "ptr:(ELEM aaa)",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(ELEM bbb)",
- "LastChild": "ptr:(CDATA '\n\t\t')",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "aaa",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 1,
- "#children": [
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
- "LastChild": "ptr:(CDATA '\n\t\t\t')",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(CDATA '\n\t\t\t')",
- "Type": "ElementNode",
- "Data": "bbb",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 2,
- "#children": [
- {
- "Parent": "ptr:(ELEM bbb)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(ELEM ccc)",
- "Type": "CharDataNode",
- "Data": "\n\t\t\t\tbbb child text\n\t\t\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 3,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM bbb)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t\t')",
- "Type": "ElementNode",
- "Data": "ccc",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 3,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM bbb)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(ELEM ccc)",
- "NextSibling": "ptr:(nil)",
- "Type": "CharDataNode",
- "Data": "\n\t\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 3,
- "#children": []
- }
- ]
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(ELEM bbb)",
- "NextSibling": "ptr:(ELEM ddd)",
- "Type": "CharDataNode",
- "Data": "\n\t\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 2,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(ELEM eee)",
- "LastChild": "ptr:(ELEM eee)",
- "PrevSibling": "ptr:(CDATA '\n\t\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "ElementNode",
- "Data": "ddd",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 2,
- "#children": [
- {
- "Parent": "ptr:(ELEM ddd)",
- "FirstChild": "ptr:(ELEM fff)",
- "LastChild": "ptr:(ELEM fff)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "eee",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 3,
- "#children": [
- {
- "Parent": "ptr:(ELEM eee)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "fff",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 4,
- "#children": []
- }
- ]
- }
- ]
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(ELEM ddd)",
- "NextSibling": "ptr:(nil)",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 2,
- "#children": []
- }
- ]
- }
- ]
-}
-
+{
+ "Parent": "ptr:(nil)",
+ "FirstChild": "ptr:(DECL 'xml')",
+ "LastChild": "ptr:(ELEM aaa)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DocumentNode",
+ "Data": "",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 0,
+ "#children": [
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DeclarationNode",
+ "Data": "xml",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [
+ {
+ "Name": {
+ "Space": "",
+ "Local": "version"
+ },
+ "Value": "1.0"
+ },
+ {
+ "Name": {
+ "Space": "",
+ "Local": "encoding"
+ },
+ "Value": "UTF-8"
+ }
+ ],
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(DECL 'xml')",
+ "NextSibling": "ptr:(DECL 'xml-stylesheet')",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DeclarationNode",
+ "Data": "xml-stylesheet",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [
+ {
+ "Name": {
+ "Space": "",
+ "Local": "type"
+ },
+ "Value": "text/xsl"
+ },
+ {
+ "Name": {
+ "Space": "",
+ "Local": "href"
+ },
+ "Value": "style.xsl"
+ }
+ ],
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(DECL 'xml-stylesheet')",
+ "NextSibling": "ptr:(COMMENT ' root comment here')",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "CommentNode",
+ "Data": " root comment here",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(COMMENT ' root comment here')",
+ "NextSibling": "ptr:(ELEM aaa)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(ELEM bbb)",
+ "LastChild": "ptr:(CDATA '\n\t\t')",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "aaa",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 1,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
+ "LastChild": "ptr:(CDATA '\n\t\t\t')",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(CDATA '\n\t\t\t')",
+ "Type": "ElementNode",
+ "Data": "bbb",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 2,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM bbb)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(ELEM ccc)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t\t\tbbb child text\n\t\t\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 3,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM bbb)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t\t')",
+ "Type": "ElementNode",
+ "Data": "ccc",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 3,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM bbb)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(ELEM ccc)",
+ "NextSibling": "ptr:(nil)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 3,
+ "#children": []
+ }
+ ]
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(ELEM bbb)",
+ "NextSibling": "ptr:(ELEM ddd)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 2,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(ELEM eee)",
+ "LastChild": "ptr:(ELEM eee)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "ElementNode",
+ "Data": "ddd",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 2,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM ddd)",
+ "FirstChild": "ptr:(ELEM fff)",
+ "LastChild": "ptr:(ELEM fff)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "eee",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 3,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM eee)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "fff",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 4,
+ "#children": []
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(ELEM ddd)",
+ "NextSibling": "ptr:(nil)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 2,
+ "#children": []
+ }
+ ]
+ }
+ ]
+}
+
--- FAIL: TestRemove/remove_on_a_root_does_nothing (0.00s)
node_test.go:171: snapshot not equal:
--- Previous
+++ Current
@@ -1,289 +1,289 @@
-{
- "Parent": "ptr:(nil)",
- "FirstChild": "ptr:(DECL 'xml')",
- "LastChild": "ptr:(ELEM aaa)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DocumentNode",
- "Data": "",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 0,
- "#children": [
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DeclarationNode",
- "Data": "xml",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [
- {
- "Name": {
- "Space": "",
- "Local": "version"
- },
- "Value": "1.0"
- },
- {
- "Name": {
- "Space": "",
- "Local": "encoding"
- },
- "Value": "UTF-8"
- }
- ],
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(DECL 'xml')",
- "NextSibling": "ptr:(DECL 'xml-stylesheet')",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "DeclarationNode",
- "Data": "xml-stylesheet",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [
- {
- "Name": {
- "Space": "",
- "Local": "type"
- },
- "Value": "text/xsl"
- },
- {
- "Name": {
- "Space": "",
- "Local": "href"
- },
- "Value": "style.xsl"
- }
- ],
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(DECL 'xml-stylesheet')",
- "NextSibling": "ptr:(COMMENT ' root comment here')",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "CommentNode",
- "Data": " root comment here",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(COMMENT ' root comment here')",
- "NextSibling": "ptr:(ELEM aaa)",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 1,
- "#children": []
- },
- {
- "Parent": "ptr:(ROOT)",
- "FirstChild": "ptr:(ELEM bbb)",
- "LastChild": "ptr:(ELEM ggg)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "aaa",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 1,
- "#children": [
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
- "LastChild": "ptr:(CDATA '\n\t\t\t')",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(CDATA '\n\t\t\t')",
- "Type": "ElementNode",
- "Data": "bbb",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 2,
- "#children": [
- {
- "Parent": "ptr:(ELEM bbb)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(ELEM ccc)",
- "Type": "CharDataNode",
- "Data": "\n\t\t\t\tbbb child text\n\t\t\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 3,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM bbb)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t\t')",
- "Type": "ElementNode",
- "Data": "ccc",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 3,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM bbb)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(ELEM ccc)",
- "NextSibling": "ptr:(nil)",
- "Type": "CharDataNode",
- "Data": "\n\t\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 3,
- "#children": []
- }
- ]
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(ELEM bbb)",
- "NextSibling": "ptr:(ELEM ddd)",
- "Type": "CharDataNode",
- "Data": "\n\t\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 2,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(ELEM eee)",
- "LastChild": "ptr:(ELEM eee)",
- "PrevSibling": "ptr:(CDATA '\n\t\t\t')",
- "NextSibling": "ptr:(CDATA '\n\t\t')",
- "Type": "ElementNode",
- "Data": "ddd",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 2,
- "#children": [
- {
- "Parent": "ptr:(ELEM ddd)",
- "FirstChild": "ptr:(ELEM fff)",
- "LastChild": "ptr:(ELEM fff)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "eee",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 3,
- "#children": [
- {
- "Parent": "ptr:(ELEM eee)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(nil)",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "fff",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 4,
- "#children": []
- }
- ]
- }
- ]
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(ELEM ddd)",
- "NextSibling": "ptr:(ELEM ggg)",
- "Type": "CharDataNode",
- "Data": "\n\t\t",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": null,
- "Level": 2,
- "#children": []
- },
- {
- "Parent": "ptr:(ELEM aaa)",
- "FirstChild": "ptr:(nil)",
- "LastChild": "ptr:(nil)",
- "PrevSibling": "ptr:(CDATA '\n\t\t')",
- "NextSibling": "ptr:(nil)",
- "Type": "ElementNode",
- "Data": "ggg",
- "Prefix": "",
- "NamespaceURI": "",
- "Attr": [],
- "Level": 2,
- "#children": []
- }
- ]
- }
- ]
-}
-
+{
+ "Parent": "ptr:(nil)",
+ "FirstChild": "ptr:(DECL 'xml')",
+ "LastChild": "ptr:(ELEM aaa)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DocumentNode",
+ "Data": "",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 0,
+ "#children": [
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DeclarationNode",
+ "Data": "xml",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [
+ {
+ "Name": {
+ "Space": "",
+ "Local": "version"
+ },
+ "Value": "1.0"
+ },
+ {
+ "Name": {
+ "Space": "",
+ "Local": "encoding"
+ },
+ "Value": "UTF-8"
+ }
+ ],
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(DECL 'xml')",
+ "NextSibling": "ptr:(DECL 'xml-stylesheet')",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "DeclarationNode",
+ "Data": "xml-stylesheet",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [
+ {
+ "Name": {
+ "Space": "",
+ "Local": "type"
+ },
+ "Value": "text/xsl"
+ },
+ {
+ "Name": {
+ "Space": "",
+ "Local": "href"
+ },
+ "Value": "style.xsl"
+ }
+ ],
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(DECL 'xml-stylesheet')",
+ "NextSibling": "ptr:(COMMENT ' root comment here')",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "CommentNode",
+ "Data": " root comment here",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(COMMENT ' root comment here')",
+ "NextSibling": "ptr:(ELEM aaa)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 1,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ROOT)",
+ "FirstChild": "ptr:(ELEM bbb)",
+ "LastChild": "ptr:(ELEM ggg)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "aaa",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 1,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
+ "LastChild": "ptr:(CDATA '\n\t\t\t')",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(CDATA '\n\t\t\t')",
+ "Type": "ElementNode",
+ "Data": "bbb",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 2,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM bbb)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(ELEM ccc)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t\t\tbbb child text\n\t\t\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 3,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM bbb)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t\t\tbbb child text\n\t\t\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t\t')",
+ "Type": "ElementNode",
+ "Data": "ccc",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 3,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM bbb)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(ELEM ccc)",
+ "NextSibling": "ptr:(nil)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 3,
+ "#children": []
+ }
+ ]
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(ELEM bbb)",
+ "NextSibling": "ptr:(ELEM ddd)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 2,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(ELEM eee)",
+ "LastChild": "ptr:(ELEM eee)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t\t')",
+ "NextSibling": "ptr:(CDATA '\n\t\t')",
+ "Type": "ElementNode",
+ "Data": "ddd",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 2,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM ddd)",
+ "FirstChild": "ptr:(ELEM fff)",
+ "LastChild": "ptr:(ELEM fff)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "eee",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 3,
+ "#children": [
+ {
+ "Parent": "ptr:(ELEM eee)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(nil)",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "fff",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 4,
+ "#children": []
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(ELEM ddd)",
+ "NextSibling": "ptr:(ELEM ggg)",
+ "Type": "CharDataNode",
+ "Data": "\n\t\t",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": null,
+ "Level": 2,
+ "#children": []
+ },
+ {
+ "Parent": "ptr:(ELEM aaa)",
+ "FirstChild": "ptr:(nil)",
+ "LastChild": "ptr:(nil)",
+ "PrevSibling": "ptr:(CDATA '\n\t\t')",
+ "NextSibling": "ptr:(nil)",
+ "Type": "ElementNode",
+ "Data": "ggg",
+ "Prefix": "",
+ "NamespaceURI": "",
+ "Attr": [],
+ "Level": 2,
+ "#children": []
+ }
+ ]
+ }
+ ]
+}
+
FAIL
exit status 1
FAIL github.com/antchfx/xmlquery 0.308s
Hm... @zhengchun It's a bit strange: I compared the printed text from your cut&paste above, seems like the - Previous
vs + Curent
are identical. I'm suspecting because it's due to OS (mac/linux vs Windows) different treatment about "\n"
(where on Mac/Linux "\n"
is written out as LF (ASCII code: 0A)
whereas on Windows, "\n"
is written out as CR LF (ASCII code: 0D 0A)
.
Can you run the tests again:
UPDATE_SNAPSHOTS=true go test ./...
And after that, git status
to see if any of the snapshot files are updated or not.
Sorry for the trouble and thx for the patience. Snapshot testing is really useful, want to get it right. But honestly never encountered Windows dev machine before :)
Thanks, Testing passed after update snapshots. There is a little problem, The Snapshot files cannot compatibility with windows and linux.
@zhengchun given cupaloy
incompatibility between (mac,linux) vs windows, dropping snapshot testing support :(
I'll raise an issue with cupaloy
but it doesn't seem to have active delopment. I've also raised suggestions to testify
which is popular and in active development. Hopefully testify
can add snapshot support soon.
It is what it is. Please take a look. Thx!
Merged. We will add snapshot for testing when they are available.
This is pt1 of adding stream parser support. See original proof-of-concept PR at https://github.com/antchfx/xmlquery/pull/32.
Add
removeFromTree
helper. This is needed during the stream parsing: every time when we load and match a target node, we must remove the previous target node from the DOM tree (or otherwise it defeats the purpose of stream parsing to avoid memory constraints)Add
*Node
and various type marshaling code inmarshal_test.go
for test snapshotting. The reason putting these in a_test.go
file is to avoid adding them into the production code that would 'pollute' the library.Add dependency to
cupaloy
for test snapshots.In the future, to update any test snapshots, simply add
UPDATE_SNAPSHOTS=true
env var: