public
Description: Prototype goodness
Clone URL: git://github.com/samleb/prototype-fruits.git
Search Repo:
Add unit tests for array extensions.
samleb (author)
Mon May 12 14:13:07 -0700 2008
commit  5afe3749efb966b6a8fd9f589529ae43c26c510c
tree    94cb0b1c73b7a323a1e10871e156abac778a9d52
parent  2ce4c44f304af1aa292453040a72bc2abce6a635
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
0
@@ -1 +1,29 @@
0
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
0
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
0
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
0
+<head>
0
+ <title>Prototype Unit test file | Base</title>
0
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
0
+ <script src="../lib/prototype.js" type="text/javascript"></script>
0
+ <script src="../lib/unittest.js" type="text/javascript"></script>
0
+
0
+ <script src="../lib/prototype.js" type="text/javascript"></script>
0
+ <script src="../lib/unittest.js" type="text/javascript"></script>
0
+
0
+ <link rel="stylesheet" href="test.css" type="text/css" />
0
+
0
+ <script src="../src/array_extensions.js" type="text/javascript"></script>
0
+
0
+ <script src="array_test.js" type="text/javascript"></script>
0
+</head>
0
+<body>
0
+<h1>Prototype Unit test file</h1>
0
+<h2>Array</h2>
0
+
0
+<!-- Log output start -->
0
+<div id="testlog"></div>
0
+<!-- Log output end -->
0
+
0
+</body>
0
+</html>
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
0
@@ -1 +1,32 @@
0
+new Test.Unit.Runner({
0
+ testRemoveAt: function(){with(this){
0
+ var array = $R(1, 5).toArray();
0
+ array.removeAt(0);
0
+ assertEnumEqual([ 2, 3, 4, 5 ], array);
0
+ assertEqual(4, array.removeAt(-2));
0
+ assertEnumEqual([ 2, 3, 5 ], array);
0
+ assertEqual(5, array.removeAt(-1));
0
+ assertEnumEqual([ 2, 3 ], array);
0
+ assertUndefined(array.removeAt(6));
0
+ assertUndefined(array.removeAt(-6));
0
+ assertEnumEqual([ 2, 3 ], array);
0
+ assertUndefined(array.removeAt(2));
0
+ assertEqual(3, array.removeAt(1));
0
+ assertEqual(2, array.removeAt(-1));
0
+ assertEqual(0, array.length);
0
+ }},
0
+
0
+ testRemoveIf: function(){with(this){
0
+ var array = $R(1, 5).toArray();
0
+ assertEnumEqual([ ], array.removeIf(function() { return false }));
0
+ assertEnumEqual([ 1, 2, 3, 4, 5 ], array);
0
+
0
+ assertEnumEqual([ 1, 2, 3, 4, 5 ], array.removeIf(function(n) { return true }));
0
+ assertEnumEqual([ ], array);
0
+
0
+ array = $R(1, 5).toArray();
0
+ assertEnumEqual([ 4, 5 ], array.removeIf(function(n) { return n > 3 }));
0
+ assertEnumEqual([ 1, 2, 3 ], array);
0
+ }}
0
+});

Comments

    No one has commented yet.