wax 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,86 @@
1
+ require 'test/unit'
2
+ require 'xml_util'
3
+
4
+ # This class provides unit test methods for XMLUtil.
5
+ #
6
+ # Copyright 2008 R. Mark Volkmann
7
+ #
8
+ # This file is part of WAX.
9
+ #
10
+ # WAX is free software: you can redistribute it and/or modify it
11
+ # under the terms of the GNU Lesser General Public License as published
12
+ # by the Free Software Foundation, either version 3 of the License,
13
+ # or (at your option) any later version.
14
+ #
15
+ # Foobar is distributed in the hope that it will be useful,
16
+ # but WITHOUT ANY WARRANTY; without even the implied warranty
17
+ # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18
+ # See the GNU Lesser General Public License for more details.
19
+ #
20
+ # You should have received a copy of the GNU Lesser General Public License
21
+ # along with WAX. If not, see http://www.gnu.org/licenses.
22
+ #
23
+ # R. Mark Volkmann, Object Computing, Inc.
24
+ class XMLUtilTest < Test::Unit::TestCase
25
+
26
+ def test_bad_comment
27
+ assert_raise(ArgumentError) do
28
+ XMLUtil.verify_comment("one -- two")
29
+ end
30
+ end
31
+
32
+ def test_bad_nmtoken
33
+ assert_raise(ArgumentError) do
34
+ XMLUtil.verify_nmtoken("1a")
35
+ end
36
+ end
37
+
38
+ def test_bad_version
39
+ assert_raise(ArgumentError) do
40
+ XMLUtil.verify_version("1.3")
41
+ end
42
+ end
43
+
44
+ # TODO: Uncomment after is_uri method is implemented.
45
+ def test_bad_uri
46
+ #assert_raise(ArgumentError) do
47
+ # XMLUtil.verify_uri(":junk")
48
+ #end
49
+ end
50
+
51
+ def test_escape
52
+ assert_equal "&lt;", XMLUtil.escape("<")
53
+ assert_equal "&gt;", XMLUtil.escape(">")
54
+ assert_equal "&amp;", XMLUtil.escape("&")
55
+ assert_equal "&apos;", XMLUtil.escape("'")
56
+ assert_equal "&quot;", XMLUtil.escape("\"")
57
+ assert_equal "1&lt;2&gt;3&amp;4&apos;5&quot;6", XMLUtil.escape("1<2>3&4'5\"6")
58
+ end
59
+
60
+ def test_is_comment
61
+ assert XMLUtil.is_comment("one two")
62
+ assert XMLUtil.is_comment("one - two")
63
+ assert !XMLUtil.is_comment("one -- two")
64
+ assert !XMLUtil.is_comment("-- one two")
65
+ assert !XMLUtil.is_comment("one two --")
66
+ end
67
+
68
+ def test_is_nmtoken
69
+ assert XMLUtil.is_nmtoken("a1")
70
+ assert !XMLUtil.is_nmtoken("1a")
71
+ end
72
+
73
+ # TODO: Uncomment after is_uri method is implemented.
74
+ def test_is_uri
75
+ #assert XMLUtil.is_uri("http://www.ociweb.com/foo")
76
+ #assert !XMLUtil.is_uri(":junk")
77
+ end
78
+
79
+ def test_is_version
80
+ assert XMLUtil.is_version("1.0")
81
+ assert XMLUtil.is_version("1.1")
82
+ assert XMLUtil.is_version("1.2")
83
+ assert !XMLUtil.is_version("1.3")
84
+ end
85
+
86
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wax
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.4
5
+ platform: ruby
6
+ authors:
7
+ - R. Mark Volkmann
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-09-01 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: WAX is a simple API for writing XML documents. It is particularly well-suited to writing large XML documents because it doesn't require storing them in a DOM-like structure before outputting them. XML libraries that use that approach can cause the VM to run out of memory when outputting large XML documents. For more information, see http://ociweb.com/wax.
17
+ email: mark@ociweb.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ files:
25
+ - lib/cd_demo.rb
26
+ - lib/instance_exec.rb
27
+ - lib/tutorial.rb
28
+ - lib/wax.rb
29
+ - lib/xml_util.rb
30
+ - test/test_wax.rb
31
+ - test/test_xmlutil.rb
32
+ - README.rdoc
33
+ has_rdoc: true
34
+ homepage: http://www.ociweb.com/wax/
35
+ post_install_message:
36
+ rdoc_options: []
37
+
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
45
+ version:
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
52
+ requirements:
53
+ - none
54
+ rubyforge_project: wax
55
+ rubygems_version: 1.2.0
56
+ signing_key:
57
+ specification_version: 2
58
+ summary: simple API for writing XML documents
59
+ test_files:
60
+ - test/test_wax.rb
61
+ - test/test_xmlutil.rb