VirtualBox

source: vbox/trunk/src/libs/libxml2-2.6.31/python/tests/tstURI.py@ 39915

Last change on this file since 39915 was 39915, checked in by vboxsync, 13 years ago

libxml-2.6.31 unmodified

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1#!/usr/bin/python -u
2import sys
3import libxml2
4
5# Memory debug specific
6libxml2.debugMemory(1)
7
8uri = libxml2.parseURI("http://example.org:8088/foo/bar?query=simple#fragid")
9if uri.scheme() != 'http':
10 print "Error parsing URI: wrong scheme"
11 sys.exit(1)
12if uri.server() != 'example.org':
13 print "Error parsing URI: wrong server"
14 sys.exit(1)
15if uri.port() != 8088:
16 print "Error parsing URI: wrong port"
17 sys.exit(1)
18if uri.path() != '/foo/bar':
19 print "Error parsing URI: wrong path"
20 sys.exit(1)
21if uri.query() != 'query=simple':
22 print "Error parsing URI: wrong query"
23 sys.exit(1)
24if uri.fragment() != 'fragid':
25 print "Error parsing URI: wrong query"
26 sys.exit(1)
27uri.setScheme("https")
28uri.setPort(223)
29uri.setFragment(None)
30result=uri.saveUri()
31if result != "https://example.org:223/foo/bar?query=simple":
32 print "Error modifying or saving the URI"
33uri = None
34
35# Memory debug specific
36libxml2.cleanupParser()
37if libxml2.debugMemory(1) == 0:
38 print "OK"
39else:
40 print "Memory leak %d bytes" % (libxml2.debugMemory(1))
41 libxml2.dumpMemory()
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette