Skip to content

Commit 2d93b47

Browse files
committed
Rename equalJSON to testToJSON
1 parent 6ed274a commit 2d93b47

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

test/jquery.json.test.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,95 +4,95 @@
44

55

66
// Utility function
7-
function equalJSON( json, string, description ) {
7+
function testToJSON( json, string, description ) {
88
equal( $.toJSON( json ), string, description || '' );
99
}
1010

1111
module( 'jQuery.toJSON' );
1212

1313
test( 'Basic toJSON usage', function(){
1414

15-
equalJSON(
15+
testToJSON(
1616
'hi',
1717
'"hi"',
1818
'Strings should be wrapped in double quotes'
1919
);
20-
equalJSON(
20+
testToJSON(
2121
{ apple: 2 },
2222
'{"apple":2}',
2323
'Objects'
2424
);
25-
equalJSON(
25+
testToJSON(
2626
{ apple: { apple: 2 } },
2727
'{"apple":{"apple":2}}',
2828
'Objects inside objects'
2929
);
30-
equalJSON(
30+
testToJSON(
3131
{ apple: 7, pear: 5 },
3232
'{"apple":7,"pear":5}',
3333
'Objects with multiple members should be separated by a comma'
3434
);
35-
equalJSON(
35+
testToJSON(
3636
2.5,
3737
'2.5',
3838
'Numbers with a decimal'
3939
);
40-
equalJSON(
40+
testToJSON(
4141
25,
4242
'25',
4343
'Number'
4444
);
45-
equalJSON(
45+
testToJSON(
4646
[2, 5],
4747
'[2,5]',
4848
'Array of numbers'
4949
);
50-
equalJSON(
50+
testToJSON(
5151
function() {},
5252
undefined,
5353
'Functions are not supported and should return undefined'
5454
);
55-
equalJSON(
55+
testToJSON(
5656
'C:\\A.TXT',
5757
'"C:\\\\A.TXT"',
5858
'Slashes should be double escaped'
5959
);
60-
equalJSON(
60+
testToJSON(
6161
'C:\\B.TXT',
6262
'"C:\\\\B.TXT"',
6363
'Slashes should be double escaped'
6464
);
65-
equalJSON(
65+
testToJSON(
6666
['C:\\A.TXT','C:\\B.TXT','C:\\C.TXT','C:\\D.TXT'],
6767
'["C:\\\\A.TXT","C:\\\\B.TXT","C:\\\\C.TXT","C:\\\\D.TXT"]',
6868
'Array of strings with slashes'
6969
);
70-
equalJSON(
70+
testToJSON(
7171
{'dDefault': '1.84467440737E+19'},
7272
'{"dDefault":"1.84467440737E+19"}',
7373
'Object with lower case key and value that should not be touched'
7474
);
75-
equalJSON(
75+
testToJSON(
7676
[0, false, function() {}],
7777
'[0,false,null]',
7878
'Resolve unsupported values (like functions) to null when encountered as object member values'
7979
);
80-
equalJSON(
80+
testToJSON(
8181
0,
8282
'0',
8383
'Zero is zero'
8484
);
85-
equalJSON(
85+
testToJSON(
8686
false,
8787
'false',
8888
'False is false'
8989
);
90-
equalJSON(
90+
testToJSON(
9191
null,
9292
'null',
9393
'null is null'
9494
);
95-
equalJSON(
95+
testToJSON(
9696
undefined,
9797
undefined,
9898
'undefined is not valid and should not return a string "undefined" but literally undefined'
@@ -105,7 +105,7 @@ test( 'Dates', function(){
105105
// '1224892800000' is the Epoch timestamp of midnight October 25, 2008.
106106
// Using that instead of Date(2008,10,25) to avoid errors when the user
107107
// running the tests is not in a UTC +00:00 timezone (which is very likely)
108-
equalJSON(
108+
testToJSON(
109109
new Date( 1224892800000 ),
110110
'"2008-10-25T00:00:00.000Z"',
111111
'Check date handling, likely the browser itself'
@@ -123,7 +123,7 @@ test( 'Dates', function(){
123123
JSON.stringify = null;
124124
}
125125

126-
equalJSON(
126+
testToJSON(
127127
new Date(1224892800000),
128128
'"2008-10-25T00:00:00.000Z"',
129129
'Testing fallback, any native browser handling disabled'
@@ -135,7 +135,7 @@ test( 'Dates', function(){
135135
JSON.stringify = jsonStringify;
136136
}
137137

138-
equalJSON(
138+
testToJSON(
139139
new Date(1224892800000),
140140
'"2008-10-25T00:00:00.000Z"',
141141
'Sanity check in case something screwed up'
@@ -146,7 +146,7 @@ test( 'Dates', function(){
146146
test( 'Function arguments object', function(){
147147

148148
function argTest( one, two, three ) {
149-
equalJSON(
149+
testToJSON(
150150
arguments,
151151
'{"0":"foo","1":"bar","2":"baz"}',
152152
'arguments, as instance of Arguments, should be treated as an object'
@@ -160,12 +160,12 @@ test( 'Function arguments object', function(){
160160
test( 'Undefined and null', function(){
161161

162162

163-
equalJSON(
163+
testToJSON(
164164
{ apple: undefined, pear: 5 },
165165
'{"pear":5}',
166166
'Objects with a member with value of type undefined should be removed'
167167
);
168-
equalJSON(
168+
testToJSON(
169169
[undefined, undefined, 1, 2],
170170
'[null,null,1,2]',
171171
'Resolve undefined to null when encountered as object member values'

0 commit comments

Comments
 (0)