@@ -3,16 +3,16 @@ describe("About Arrays", function() {
3
3
//We shall contemplate truth by testing reality, via spec expectations.
4
4
it ( "should create arrays" , function ( ) {
5
5
var emptyArray = [ ] ;
6
- expect ( typeof ( emptyArray ) ) . toBe ( __ ) ; //A mistake? - http:javascript.crockford.com/remedial.html
7
- expect ( emptyArray . length ) . toBe ( __ ) ;
6
+ expect ( typeof ( emptyArray ) ) . toBe ( FILL_ME_IN ) ; //A mistake? - http:javascript.crockford.com/remedial.html
7
+ expect ( emptyArray . length ) . toBe ( FILL_ME_IN ) ;
8
8
9
9
var multiTypeArray = [ 0 , 1 , "two" , function ( ) { return 3 ; } , { value1 : 4 , value2 : 5 } , [ 6 , 7 ] ] ;
10
- expect ( multiTypeArray [ 0 ] ) . toBe ( __ ) ;
11
- expect ( multiTypeArray [ 2 ] ) . toBe ( __ ) ;
12
- expect ( multiTypeArray [ 3 ] ( ) ) . toBe ( __ ) ;
13
- expect ( multiTypeArray [ 4 ] . value1 ) . toBe ( __ ) ;
14
- expect ( multiTypeArray [ 4 ] [ "value2" ] ) . toBe ( __ ) ;
15
- expect ( multiTypeArray [ 5 ] [ 0 ] ) . toBe ( __ ) ;
10
+ expect ( multiTypeArray [ 0 ] ) . toBe ( FILL_ME_IN ) ;
11
+ expect ( multiTypeArray [ 2 ] ) . toBe ( FILL_ME_IN ) ;
12
+ expect ( multiTypeArray [ 3 ] ( ) ) . toBe ( FILL_ME_IN ) ;
13
+ expect ( multiTypeArray [ 4 ] . value1 ) . toBe ( FILL_ME_IN ) ;
14
+ expect ( multiTypeArray [ 4 ] [ "value2" ] ) . toBe ( FILL_ME_IN ) ;
15
+ expect ( multiTypeArray [ 5 ] [ 0 ] ) . toBe ( FILL_ME_IN ) ;
16
16
} ) ;
17
17
18
18
it ( "should understand array literals" , function ( ) {
@@ -23,36 +23,36 @@ describe("About Arrays", function() {
23
23
expect ( array ) . toEqual ( [ 1 ] ) ;
24
24
25
25
array [ 1 ] = 2 ;
26
- expect ( array ) . toEqual ( [ 1 , __ ] ) ;
26
+ expect ( array ) . toEqual ( [ 1 , FILL_ME_IN ] ) ;
27
27
28
28
array . push ( 3 ) ;
29
- expect ( array ) . toEqual ( __ ) ;
29
+ expect ( array ) . toEqual ( FILL_ME_IN ) ;
30
30
} ) ;
31
31
32
32
it ( "should understand array length" , function ( ) {
33
33
var fourNumberArray = [ 1 , 2 , 3 , 4 ] ;
34
34
35
- expect ( fourNumberArray . length ) . toBe ( __ ) ;
35
+ expect ( fourNumberArray . length ) . toBe ( FILL_ME_IN ) ;
36
36
fourNumberArray . push ( 5 , 6 ) ;
37
- expect ( fourNumberArray . length ) . toBe ( __ ) ;
37
+ expect ( fourNumberArray . length ) . toBe ( FILL_ME_IN ) ;
38
38
39
39
var tenEmptyElementArray = new Array ( 10 ) ;
40
- expect ( tenEmptyElementArray . length ) . toBe ( __ ) ;
40
+ expect ( tenEmptyElementArray . length ) . toBe ( FILL_ME_IN ) ;
41
41
42
42
tenEmptyElementArray . length = 5 ;
43
- expect ( tenEmptyElementArray . length ) . toBe ( __ ) ;
43
+ expect ( tenEmptyElementArray . length ) . toBe ( FILL_ME_IN ) ;
44
44
} ) ;
45
45
46
46
it ( "should slice arrays" , function ( ) {
47
47
var array = [ "peanut" , "butter" , "and" , "jelly" ] ;
48
48
49
- expect ( array . slice ( 0 , 1 ) ) . toEqual ( __ ) ;
50
- expect ( array . slice ( 0 , 2 ) ) . toEqual ( __ ) ;
51
- expect ( array . slice ( 2 , 2 ) ) . toEqual ( __ ) ;
52
- expect ( array . slice ( 2 , 20 ) ) . toEqual ( __ ) ;
53
- expect ( array . slice ( 3 , 0 ) ) . toEqual ( __ ) ;
54
- expect ( array . slice ( 3 , 100 ) ) . toEqual ( __ ) ;
55
- expect ( array . slice ( 5 , 1 ) ) . toEqual ( __ ) ;
49
+ expect ( array . slice ( 0 , 1 ) ) . toEqual ( FILL_ME_IN ) ;
50
+ expect ( array . slice ( 0 , 2 ) ) . toEqual ( FILL_ME_IN ) ;
51
+ expect ( array . slice ( 2 , 2 ) ) . toEqual ( FILL_ME_IN ) ;
52
+ expect ( array . slice ( 2 , 20 ) ) . toEqual ( FILL_ME_IN ) ;
53
+ expect ( array . slice ( 3 , 0 ) ) . toEqual ( FILL_ME_IN ) ;
54
+ expect ( array . slice ( 3 , 100 ) ) . toEqual ( FILL_ME_IN ) ;
55
+ expect ( array . slice ( 5 , 1 ) ) . toEqual ( FILL_ME_IN ) ;
56
56
} ) ;
57
57
58
58
it ( "should know array references" , function ( ) {
@@ -62,36 +62,36 @@ describe("About Arrays", function() {
62
62
refArray [ 1 ] = "changed in function" ;
63
63
}
64
64
passedByReference ( array ) ;
65
- expect ( array [ 1 ] ) . toBe ( __ ) ;
65
+ expect ( array [ 1 ] ) . toBe ( FILL_ME_IN ) ;
66
66
67
67
var assignedArray = array ;
68
68
assignedArray [ 5 ] = "changed in assignedArray" ;
69
- expect ( array [ 5 ] ) . toBe ( __ ) ;
69
+ expect ( array [ 5 ] ) . toBe ( FILL_ME_IN ) ;
70
70
71
71
var copyOfArray = array . slice ( ) ;
72
72
copyOfArray [ 3 ] = "changed in copyOfArray" ;
73
- expect ( array [ 3 ] ) . toBe ( __ ) ;
73
+ expect ( array [ 3 ] ) . toBe ( FILL_ME_IN ) ;
74
74
} ) ;
75
75
76
76
it ( "should push and pop" , function ( ) {
77
77
var array = [ 1 , 2 ] ;
78
78
array . push ( 3 ) ;
79
79
80
- expect ( array ) . toEqual ( __ ) ;
80
+ expect ( array ) . toEqual ( FILL_ME_IN ) ;
81
81
82
82
var poppedValue = array . pop ( ) ;
83
- expect ( poppedValue ) . toBe ( __ ) ;
84
- expect ( array ) . toEqual ( __ ) ;
83
+ expect ( poppedValue ) . toBe ( FILL_ME_IN ) ;
84
+ expect ( array ) . toEqual ( FILL_ME_IN ) ;
85
85
} ) ;
86
86
87
87
it ( "should know about shifting arrays" , function ( ) {
88
88
var array = [ 1 , 2 ] ;
89
89
90
90
array . unshift ( 3 ) ;
91
- expect ( array ) . toEqual ( __ ) ;
91
+ expect ( array ) . toEqual ( FILL_ME_IN ) ;
92
92
93
93
var shiftedValue = array . shift ( ) ;
94
- expect ( shiftedValue ) . toEqual ( __ ) ;
95
- expect ( array ) . toEqual ( __ ) ;
94
+ expect ( shiftedValue ) . toEqual ( FILL_ME_IN ) ;
95
+ expect ( array ) . toEqual ( FILL_ME_IN ) ;
96
96
} ) ;
97
97
} ) ;
0 commit comments