mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-13 09:01:53 +03:00
fixed a bug pointed out by Stphane Bidoul and integrated it into the
* xmlreader.c python/tests/reader.py: fixed a bug pointed out by Stphane Bidoul and integrated it into the tests Daniel
This commit is contained in:
@ -235,6 +235,36 @@ if reader.MoveToNextAttribute() != 0:
|
||||
print "Failed to detect last attribute"
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
# Another test provided by St<53>phane Bidoul and checked with C#
|
||||
#
|
||||
expect="""1 (a) [None]
|
||||
1 (b) [None]
|
||||
-- 2 (b1) [b1]
|
||||
1 (c) [None]
|
||||
3 (#text) [content of c]
|
||||
15 (c) [None]
|
||||
15 (a) [None]
|
||||
"""
|
||||
res=""
|
||||
f = StringIO.StringIO("""<a><b b1="b1"/><c>content of c</c></a>""")
|
||||
input = libxml2.inputBuffer(f)
|
||||
reader = input.newTextReader("test5")
|
||||
|
||||
while reader.Read():
|
||||
res=res + "%s (%s) [%s]\n" % (reader.NodeType(),reader.Name(),
|
||||
reader.Value())
|
||||
if reader.NodeType() == 1: # Element
|
||||
while reader.MoveToNextAttribute():
|
||||
res = res + "-- %s (%s) [%s]\n" % (reader.NodeType(),
|
||||
reader.Name(),reader.Value())
|
||||
|
||||
if res != expect:
|
||||
print "test5 failed"
|
||||
print res
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
del f
|
||||
del input
|
||||
del reader
|
||||
|
Reference in New Issue
Block a user