PageRenderTime 19ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/wheels/tests/global/strings.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 92 lines | 75 code | 17 blank | 0 comment | 0 complexity | 01741e1ca94cce05e138fd6d233ee407 MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cffunction name="test_singularize">
 4		<cfset loc.result = singularize("statuses")>
 5		<cfset assert("NOT Compare(loc.result, 'status')")>
 6	</cffunction>
 7
 8	<cffunction name="test_singularize_starting_with_upper_case">
 9		<cfset loc.result = singularize("Instances")>
10		<cfset assert("NOT Compare(loc.result, 'Instance')")>
11	</cffunction>
12
13	<cffunction name="test_singularize_two_words">
14		<cfset loc.result = singularize("statusUpdates")>
15		<cfset assert("NOT Compare(loc.result, 'statusUpdate')")>
16	</cffunction>
17
18	<cffunction name="test_singularize_multiple_words">
19		<cfset loc.result = singularize("fancyChristmasTrees")>
20		<cfset assert("NOT Compare(loc.result, 'fancyChristmasTree')")>
21	</cffunction>
22
23	<cffunction name="test_pluralize">
24		<cfset loc.result = pluralize("status")>
25		<cfset assert("NOT Compare(loc.result, 'statuses')")>
26	</cffunction>
27
28	<cffunction name="test_pluralize_with_count">
29		<cfset loc.result = pluralize("statusUpdate", 0)>
30		<cfset assert("NOT Compare(loc.result, '0 statusUpdates')")>
31		<cfset loc.result = pluralize("statusUpdate", 1)>
32		<cfset assert("NOT Compare(loc.result, '1 statusUpdate')")>
33		<cfset loc.result = pluralize("statusUpdate", 2)>
34		<cfset assert("NOT Compare(loc.result, '2 statusUpdates')")>
35	</cffunction>
36
37	<cffunction name="test_pluralize_starting_with_upper_case">
38		<cfset loc.result = pluralize("Instance")>
39		<cfset assert("NOT Compare(loc.result, 'Instances')")>
40	</cffunction>
41
42	<cffunction name="test_pluralize_two_words">
43		<cfset loc.result = pluralize("statusUpdate")>
44		<cfset assert("NOT Compare(loc.result, 'statusUpdates')")>
45	</cffunction>
46
47	<cffunction name="test_pluralize_issue_450">
48		<cfset loc.result = pluralize("statuscode")>
49		<cfset assert("NOT Compare(loc.result, 'statuscodes')")>
50	</cffunction>
51
52	<cffunction name="test_pluralize_multiple_words">
53		<cfset loc.result = pluralize("fancyChristmasTree")>
54		<cfset assert("NOT Compare(loc.result, 'fancyChristmasTrees')")>
55	</cffunction>
56
57	<cffunction name="test_hyphenize_normal_variable">
58		<cfset loc.result = hyphenize("wheelsIsAFramework")>
59		<cfset assert("NOT Compare(loc.result, 'wheels-is-a-framework')")>
60	</cffunction>
61
62	<cffunction name="test_hyphenize_variable_starting_with_uppercase">
63		<cfset loc.result = hyphenize("WheelsIsAFramework")>
64		<cfset debug('loc.result', false)>
65		<cfset assert("NOT Compare(loc.result, 'wheels-is-a-framework')")>
66	</cffunction>
67
68	<cffunction name="test_hyphenize_variable_with_abbreviation">
69		<cfset loc.result = hyphenize("aURLVariable")>
70		<cfset debug('loc.result', false)>
71		<cfset assert("NOT Compare(loc.result, 'a-url-variable')")>
72	</cffunction>
73
74	<cffunction name="test_hyphenize_variable_with_abbreviation_starting_with_uppercase">
75		<cfset loc.result = hyphenize("URLVariable")>
76		<cfset debug('loc.result', false)>
77		<cfset assert("NOT Compare(loc.result, 'url-variable')")>
78	</cffunction>
79	
80	<cffunction name="test_hyphenize_should_only_insert_hyphens_in_mixed_case">
81		<cfset loc.result = hyphenize("ERRORMESSAGE")>
82		<cfset assert("NOT Compare(loc.result, 'errormessage')")>
83		<cfset loc.result = hyphenize("errormessage")>
84		<cfset assert("NOT Compare(loc.result, 'errormessage')")>
85	</cffunction>	
86
87	<cffunction name="test_singularize_of_address">
88		<cfset loc.result = singularize("address")>
89		<cfset assert("NOT Compare(loc.result, 'address')")>
90	</cffunction>
91
92</cfcomponent>