C0 code coverage information
Generated on Sun Oct 26 11:18:15 -0500 2008 with rcov 0.8.1.2
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
1 require File.dirname(__FILE__) + '/../spec_helper'
2 require 'aquarium/spec_example_types'
3 require 'aquarium/utils/name_utils'
4
5 describe Aquarium::Utils::NameUtils, ".make_valid_attr_name_from_method_name" do
6 it "should convert an equal sign into _equal_" do
7 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo=bar=baz").should eql(:foo_equal_bar_equal_baz)
8 end
9
10 it "should convert an '==' sign into _equal__equal_" do
11 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo==bar==baz").should eql(:foo_equal__equal_bar_equal__equal_baz)
12 end
13
14 it "should convert an '===' sign into _equal__equal__equal_" do
15 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo===bar===baz").should eql(:foo_equal__equal__equal_bar_equal__equal__equal_baz)
16 end
17
18 it "should convert a question mark into _questionmark_" do
19 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo?bar?baz").should eql(:foo_questionmark_bar_questionmark_baz)
20 end
21
22 it "should convert an exclamation mark into _exclamationmark_" do
23 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo!bar!baz").should eql(:foo_exclamationmark_bar_exclamationmark_baz)
24 end
25
26 it "should convert a tilde into _tilde_" do
27 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo~bar~baz").should eql(:foo_tilde_bar_tilde_baz)
28 end
29
30 it "should convert a minus sign into _minus_" do
31 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo-bar-baz").should eql(:foo_minus_bar_minus_baz)
32 end
33
34 it "should convert a plus sign into _plus_" do
35 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo+bar+baz").should eql(:foo_plus_bar_plus_baz)
36 end
37
38 it "should convert a slash into _slash_" do
39 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo/bar/baz").should eql(:foo_slash_bar_slash_baz)
40 end
41
42 it "should convert a star into _star_" do
43 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo*bar*baz").should eql(:foo_star_bar_star_baz)
44 end
45
46 it "should convert a less than sign into _lessthan_" do
47 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo<bar<baz").should eql(:foo_lessthan_bar_lessthan_baz)
48 end
49
50 it "should convert a greater than sign into _greaterthan_" do
51 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo>bar>baz").should eql(:foo_greaterthan_bar_greaterthan_baz)
52 end
53
54 it "should convert a '<=>' (spaceship operator) into _greaterthan_" do
55 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo<=>bar<=>baz").should eql(:foo_lessthan__equal__greaterthan_bar_lessthan__equal__greaterthan_baz)
56 end
57
58 it "should convert a left shift into _leftshift_" do
59 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo<<bar<<baz").should eql(:foo_leftshift_bar_leftshift_baz)
60 end
61
62 it "should convert a right shift into _rightshift_" do
63 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo>>bar>>baz").should eql(:foo_rightshift_bar_rightshift_baz)
64 end
65
66 it "should convert an '=~' into _matches_" do
67 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo=~bar=~baz").should eql(:foo_matches_bar_matches_baz)
68 end
69
70 it "should convert a percent sign into _percent_" do
71 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo%bar%baz").should eql(:foo_percent_bar_percent_baz)
72 end
73
74 it "should convert a caret into _caret_" do
75 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo^bar^baz").should eql(:foo_caret_bar_caret_baz)
76 end
77
78 it "should convert a [] into _brackets_" do
79 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo[]bar[]baz").should eql(:foo_brackets_bar_brackets_baz)
80 end
81
82 it "should convert a & into _ampersand_" do
83 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo&bar&baz").should eql(:foo_ampersand_bar_ampersand_baz)
84 end
85
86 it "should convert a | into _pipe_" do
87 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo|bar|baz").should eql(:foo_pipe_bar_pipe_baz)
88 end
89
90 it "should convert a back tick into _backtick_" do
91 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo`bar`baz").should eql(:foo_backtick_bar_backtick_baz)
92 end
93
94 it "should convert all of the above in the same symbol" do
95 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo=bar?baz!boz~bat-bot+bit").should eql(
96 :foo_equal_bar_questionmark_baz_exclamationmark_boz_tilde_bat_minus_bot_plus_bit)
97 Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name('x/a*b<c>d<<e>>f=~g%i^j[]k&l|m`n'.intern).should eql(
98 :x_slash_a_star_b_lessthan_c_greaterthan_d_leftshift_e_rightshift_f_matches_g_percent_i_caret_j_brackets_k_ampersand_l_pipe_m_backtick_n)
99 end
100 end
101
102 describe Aquarium::Utils::NameUtils, ".make_valid_object_id_name" do
103 it "should return the same id string with a _neg_ prefix if the id is negative" do
104 Aquarium::Utils::NameUtils.make_valid_object_id_name("-123").should eql("_neg_123")
105 end
106
107 it "should return the same id string if the id is positive" do
108 Aquarium::Utils::NameUtils.make_valid_object_id_name("123").should eql("123")
109 end
110 end
111
112 describe Aquarium::Utils::NameUtils, ".make_valid_type_name" do
113 it "should return the same name with colons ':' converted to underscores '_'" do
114 Aquarium::Utils::NameUtils.make_valid_type_name(Aquarium::Utils::NameUtils).should eql("Aquarium__Utils__NameUtils")
115 end
116
117 it "should return the same name if there are no colons" do
118 Aquarium::Utils::NameUtils.make_valid_type_name(String).should eql("String")
119 end
120 end
121
122 describe Aquarium::Utils::NameUtils, ".make_type_or_object_key" do
123 it "should return the same string as :make_valid_type_name if the input is a type" do
124 Aquarium::Utils::NameUtils.make_type_or_object_key(Aquarium::Utils::NameUtils).should eql(Aquarium::Utils::NameUtils.make_valid_type_name(Aquarium::Utils::NameUtils))
125 end
126
127 it "should return the same string as :make_valid_object_name if the input is an object" do
128 object = "string"
129 Aquarium::Utils::NameUtils.make_type_or_object_key(object).should eql(Aquarium::Utils::NameUtils.make_valid_object_name(object))
130 end
131 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.