sdl4r 0.9.5 → 0.9.6
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.
- data/CHANGELOG +11 -2
- data/Rakefile +1 -1
- data/TODO +9 -1
- data/doc/classes/SDL4R.html +42 -196
- data/doc/classes/SDL4R/Parser.html +45 -107
- data/doc/classes/SDL4R/SdlBinary.html +59 -119
- data/doc/classes/SDL4R/SdlParseError.html +28 -50
- data/doc/classes/SDL4R/SdlTimeSpan.html +257 -475
- data/doc/classes/SDL4R/Tag.html +497 -828
- data/doc/created.rid +1 -1
- data/doc/files/CHANGELOG.html +46 -18
- data/doc/files/LICENSE.html +51 -42
- data/doc/files/README.html +42 -32
- data/doc/files/lib/sdl4r/parser/reader_rb.html +21 -11
- data/doc/files/lib/sdl4r/parser/time_span_with_zone_rb.html +21 -11
- data/doc/files/lib/sdl4r/parser/token_rb.html +21 -11
- data/doc/files/lib/sdl4r/parser/tokenizer_rb.html +21 -11
- data/doc/files/lib/sdl4r/parser_rb.html +21 -14
- data/doc/files/lib/sdl4r/sdl4r_rb.html +23 -18
- data/doc/files/lib/sdl4r/sdl_binary_rb.html +21 -11
- data/doc/files/lib/sdl4r/sdl_parse_error_rb.html +21 -11
- data/doc/files/lib/sdl4r/sdl_time_span_rb.html +21 -11
- data/doc/files/lib/sdl4r/tag_rb.html +23 -18
- data/doc/files/lib/sdl4r_rb.html +21 -11
- data/doc/fr_class_index.html +11 -14
- data/doc/fr_file_index.html +11 -22
- data/doc/fr_method_index.html +90 -175
- data/doc/index.html +7 -4
- data/doc/rdoc-style.css +119 -210
- data/lib/sdl4r/tag.rb +23 -12
- data/test/sdl4r/tag_test.rb +53 -0
- metadata +9 -4
data/test/sdl4r/tag_test.rb
CHANGED
@@ -222,6 +222,12 @@ module SDL4R
|
|
222
222
|
assert_equal [1, 2, 3], tag1.children[0].values
|
223
223
|
assert_equal [4, 5, 6], tag1.children[1].values
|
224
224
|
assert_equal 2, tag1.child_count
|
225
|
+
|
226
|
+
# Test empty or nil attribute value
|
227
|
+
tag1.clear_attributes
|
228
|
+
tag1 << { "a1" => "" }
|
229
|
+
tag1 << { "a2" => nil }
|
230
|
+
assert_equal({ "a1" => "", "a2" => nil }, tag1.attributes)
|
225
231
|
end
|
226
232
|
|
227
233
|
def test_attributes
|
@@ -261,6 +267,10 @@ module SDL4R
|
|
261
267
|
tag.clear_attributes
|
262
268
|
assert_nil tag.attribute("a2")
|
263
269
|
assert_equal({}, tag.attributes)
|
270
|
+
|
271
|
+
# test empty value
|
272
|
+
tag.set_attribute("a1", "")
|
273
|
+
assert_equal "", tag.attribute("a1")
|
264
274
|
end
|
265
275
|
|
266
276
|
def test_attributes_with_namespace
|
@@ -485,6 +495,49 @@ EOF
|
|
485
495
|
assert_equal "123", xml_doc.elements[1].elements[1].attribute("a1").value
|
486
496
|
end
|
487
497
|
|
498
|
+
def test_write
|
499
|
+
root = Tag.new("root")
|
500
|
+
|
501
|
+
output = ""
|
502
|
+
root.write(output)
|
503
|
+
assert_equal "", output
|
504
|
+
|
505
|
+
output = ""
|
506
|
+
root.write(output, true)
|
507
|
+
assert_equal "root", output
|
508
|
+
|
509
|
+
child1 = root.new_child "child1"
|
510
|
+
child1 << 123
|
511
|
+
|
512
|
+
output = ""
|
513
|
+
root.write(output)
|
514
|
+
assert_equal "child1 123", output
|
515
|
+
|
516
|
+
output = ""
|
517
|
+
root.write(output, true)
|
518
|
+
assert_equal(
|
519
|
+
"root {\n" +
|
520
|
+
"\tchild1 123\n" +
|
521
|
+
"}",
|
522
|
+
output)
|
523
|
+
|
524
|
+
child1 = root.new_child "child2"
|
525
|
+
child1 << "abc"
|
526
|
+
|
527
|
+
output = ""
|
528
|
+
root.write(output)
|
529
|
+
assert_equal "child1 123\nchild2 \"abc\"", output
|
530
|
+
|
531
|
+
output = ""
|
532
|
+
root.write(output, true)
|
533
|
+
assert_equal(
|
534
|
+
"root {\n" +
|
535
|
+
"\tchild1 123\n" +
|
536
|
+
"\tchild2 \"abc\"\n" +
|
537
|
+
"}",
|
538
|
+
output)
|
539
|
+
end
|
540
|
+
|
488
541
|
end
|
489
542
|
|
490
543
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sdl4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 55
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
9
|
+
- 6
|
10
|
+
version: 0.9.6
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Philippe Vosges
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-08-
|
19
|
+
date: 2010-08-10 00:00:00 +09:00
|
19
20
|
default_executable:
|
20
21
|
dependencies: []
|
21
22
|
|
@@ -86,23 +87,27 @@ rdoc_options: []
|
|
86
87
|
require_paths:
|
87
88
|
- lib
|
88
89
|
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
89
91
|
requirements:
|
90
92
|
- - ">="
|
91
93
|
- !ruby/object:Gem::Version
|
94
|
+
hash: 3
|
92
95
|
segments:
|
93
96
|
- 0
|
94
97
|
version: "0"
|
95
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
96
100
|
requirements:
|
97
101
|
- - ">="
|
98
102
|
- !ruby/object:Gem::Version
|
103
|
+
hash: 3
|
99
104
|
segments:
|
100
105
|
- 0
|
101
106
|
version: "0"
|
102
107
|
requirements:
|
103
108
|
- none
|
104
109
|
rubyforge_project: sdl4r
|
105
|
-
rubygems_version: 1.3.
|
110
|
+
rubygems_version: 1.3.7
|
106
111
|
signing_key:
|
107
112
|
specification_version: 3
|
108
113
|
summary: Simple Declarative Language for Ruby library
|