blankslate 3.1.2 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +22 -0
- data/MIT-LICENSE +1 -1
- data/README +31 -0
- data/Rakefile +8 -184
- data/VERSION +1 -0
- data/blankslate.gemspec +22 -0
- data/lib/blankslate.rb +6 -2
- data/spec/blankslate_spec.rb +54 -0
- metadata +67 -81
- data/CHANGES +0 -101
- data/README.rdoc +0 -225
- data/doc/releases/builder-1.2.4.rdoc +0 -31
- data/doc/releases/builder-2.0.0.rdoc +0 -46
- data/doc/releases/builder-2.1.1.rdoc +0 -58
- data/test/test_blankslate.rb +0 -217
- data/test/test_eventbuilder.rb +0 -150
- data/test/test_markupbuilder.rb +0 -573
- data/test/test_method_caching.rb +0 -62
- data/test/test_namecollision.rb +0 -39
- data/test/test_xchar.rb +0 -77
data/test/test_method_caching.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
#--
|
4
|
-
# Portions copyright 2011 by Bart ten Brinke (info@retrosync.com).
|
5
|
-
# All rights reserved.
|
6
|
-
|
7
|
-
# Permission is granted for use, copying, modification, distribution,
|
8
|
-
# and distribution of modified versions of this work as long as the
|
9
|
-
# above copyright notice is included.
|
10
|
-
#++
|
11
|
-
|
12
|
-
require 'test/unit'
|
13
|
-
require 'test/preload'
|
14
|
-
require 'builder'
|
15
|
-
|
16
|
-
class TestMethodCaching < Test::Unit::TestCase
|
17
|
-
|
18
|
-
# We can directly ask if xml object responds to the cache_me or
|
19
|
-
# do_not_cache_me methods because xml is derived from BasicObject
|
20
|
-
# (and repond_to? is not defined in BasicObject).
|
21
|
-
#
|
22
|
-
# Instead we are going to stub out method_missing so that it throws
|
23
|
-
# an error, and then make sure that error is either thrown or not
|
24
|
-
# thrown as appropriate.
|
25
|
-
|
26
|
-
def teardown
|
27
|
-
super
|
28
|
-
Builder::XmlBase.cache_method_calls = true
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_caching_does_not_break_weird_symbols
|
32
|
-
xml = Builder::XmlMarkup.new
|
33
|
-
xml.__send__("work-order", 1)
|
34
|
-
assert_equal "<work-order>1</work-order>", xml.target!
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_method_call_caching
|
38
|
-
xml = Builder::XmlMarkup.new
|
39
|
-
xml.cache_me
|
40
|
-
|
41
|
-
def xml.method_missing(*args)
|
42
|
-
::Kernel.fail StandardError, "SHOULD NOT BE CALLED"
|
43
|
-
end
|
44
|
-
assert_nothing_raised do
|
45
|
-
xml.cache_me
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_method_call_caching_disabled
|
50
|
-
Builder::XmlBase.cache_method_calls = false
|
51
|
-
xml = Builder::XmlMarkup.new
|
52
|
-
xml.do_not_cache_me
|
53
|
-
|
54
|
-
def xml.method_missing(*args)
|
55
|
-
::Kernel.fail StandardError, "SHOULD BE CALLED"
|
56
|
-
end
|
57
|
-
assert_raise(StandardError, /SHOULD BE CALLED/) do
|
58
|
-
xml.do_not_cache_me
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
data/test/test_namecollision.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
#--
|
4
|
-
# Portions copyright 2004 by Jim Weirich (jim@weirichhouse.org).
|
5
|
-
# Portions copyright 2005 by Sam Ruby (rubys@intertwingly.net).
|
6
|
-
# All rights reserved.
|
7
|
-
|
8
|
-
# Permission is granted for use, copying, modification, distribution,
|
9
|
-
# and distribution of modified versions of this work as long as the
|
10
|
-
# above copyright notice is included.
|
11
|
-
#++
|
12
|
-
|
13
|
-
require 'test/unit'
|
14
|
-
require 'builder/xchar'
|
15
|
-
|
16
|
-
class TestNameCollisions < Test::Unit::TestCase
|
17
|
-
module Collide
|
18
|
-
def xchr
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_no_collision
|
23
|
-
assert_nothing_raised do
|
24
|
-
Builder.check_for_name_collision(Collide, :not_defined)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_collision
|
29
|
-
assert_raise RuntimeError do
|
30
|
-
Builder.check_for_name_collision(Collide, "xchr")
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_collision_with_symbol
|
35
|
-
assert_raise RuntimeError do
|
36
|
-
Builder.check_for_name_collision(Collide, :xchr)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/test/test_xchar.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
#--
|
4
|
-
# Portions copyright 2004 by Jim Weirich (jim@weirichhouse.org).
|
5
|
-
# Portions copyright 2005 by Sam Ruby (rubys@intertwingly.net).
|
6
|
-
# All rights reserved.
|
7
|
-
|
8
|
-
# Permission is granted for use, copying, modification, distribution,
|
9
|
-
# and distribution of modified versions of this work as long as the
|
10
|
-
# above copyright notice is included.
|
11
|
-
#++
|
12
|
-
|
13
|
-
#!/usr/bin/env ruby
|
14
|
-
|
15
|
-
require 'test/unit'
|
16
|
-
require 'builder/xchar'
|
17
|
-
|
18
|
-
if String.method_defined?(:encode)
|
19
|
-
class String
|
20
|
-
ENCODING_BINARY = Encoding.find('BINARY')
|
21
|
-
|
22
|
-
# shim method for testing purposes
|
23
|
-
def to_xs(escape=true)
|
24
|
-
raise NameError.new('to_xs') unless caller[0].index(__FILE__)
|
25
|
-
|
26
|
-
result = Builder::XChar.encode(self)
|
27
|
-
if escape
|
28
|
-
result.gsub(/[^\u0000-\u007F]/) {|c| "&##{c.ord};"}
|
29
|
-
else
|
30
|
-
# really only useful for testing purposes
|
31
|
-
result.force_encoding(ENCODING_BINARY)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
class TestXmlEscaping < Test::Unit::TestCase
|
38
|
-
REPLACEMENT_CHAR = Builder::XChar::REPLACEMENT_CHAR.to_xs
|
39
|
-
|
40
|
-
def test_ascii
|
41
|
-
assert_equal 'abc', 'abc'.to_xs
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_predefined
|
45
|
-
assert_equal '&', '&'.to_xs # ampersand
|
46
|
-
assert_equal '<', '<'.to_xs # left angle bracket
|
47
|
-
assert_equal '>', '>'.to_xs # right angle bracket
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_invalid
|
51
|
-
assert_equal REPLACEMENT_CHAR, "\x00".to_xs # null
|
52
|
-
assert_equal REPLACEMENT_CHAR, "\x0C".to_xs # form feed
|
53
|
-
assert_equal REPLACEMENT_CHAR, "\xEF\xBF\xBF".to_xs # U+FFFF
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_iso_8859_1
|
57
|
-
assert_equal 'ç', "\xE7".to_xs # small c cedilla
|
58
|
-
assert_equal '©', "\xA9".to_xs # copyright symbol
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_win_1252
|
62
|
-
assert_equal '’', "\x92".to_xs # smart quote
|
63
|
-
assert_equal '€', "\x80".to_xs # euro
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_utf8
|
67
|
-
assert_equal '’', "\xE2\x80\x99".to_xs # right single quote
|
68
|
-
assert_equal '©', "\xC2\xA9".to_xs # copy
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_utf8_verbatim
|
72
|
-
assert_equal "\xE2\x80\x99", "\xE2\x80\x99".to_xs(false) # right single quote
|
73
|
-
assert_equal "\xC2\xA9", "\xC2\xA9".to_xs(false) # copy
|
74
|
-
assert_equal "\xC2\xA9&\xC2\xA9",
|
75
|
-
"\xC2\xA9&\xC2\xA9".to_xs(false) # copy with ampersand
|
76
|
-
end
|
77
|
-
end
|