@@ -5,31 +5,31 @@ test("defining functions directly", function() {
5
5
function changeResult ( ) {
6
6
// the ability to access a variables defined in the same scope as the function is known as 'closure'
7
7
result = "b" ;
8
- } ;
8
+ } ;
9
9
changeResult ( ) ;
10
- equals ( result , __ , 'what is the value of result?' ) ;
10
+ equal ( __ , result , 'what is the value of result?' ) ;
11
11
} ) ;
12
12
13
13
test ( "assigning functions to variables" , function ( ) {
14
14
var triple = function ( input ) {
15
15
return input * 3 ;
16
16
} ;
17
- equals ( triple ( 4 ) , __ , 'what is triple 4?' ) ;
17
+ equal ( __ , triple ( 4 ) , 'what is triple 4?' ) ;
18
18
} ) ;
19
19
20
- test ( "self invoking functions" , function ( ) {
20
+ test ( "self invoking functions" , function ( ) {
21
21
var publicValue = "shared" ;
22
22
23
23
// self invoking functions are used to provide scoping and to alias variables
24
24
( function ( pv ) {
25
25
var secretValue = "password" ;
26
- equals ( pv , __ , 'what is the value of pv?' ) ;
27
- equals ( typeof ( secretValue ) , "__" , "is secretValue available in this context?" ) ;
28
- equals ( typeof ( publicValue ) , "__" , "is publicValue available in this context?" ) ;
26
+ equal ( __ , pv , 'what is the value of pv?' ) ;
27
+ equal ( "__" , typeof ( secretValue ) , "is secretValue available in this context?" ) ;
28
+ equal ( "__" , typeof ( publicValue ) , "is publicValue available in this context?" ) ;
29
29
} ) ( publicValue ) ;
30
30
31
- equals ( typeof ( secretValue ) , "__" , "is secretValue available in this context?" ) ;
32
- equals ( typeof ( publicValue ) , "__" , "is publicValue available in this context?" ) ;
31
+ equal ( "__" , typeof ( secretValue ) , "is secretValue available in this context?" ) ;
32
+ equal ( "__" , typeof ( publicValue ) , "is publicValue available in this context?" ) ;
33
33
} ) ;
34
34
35
35
test ( "arguments array" , function ( ) {
@@ -42,8 +42,8 @@ test("arguments array", function() {
42
42
// __
43
43
} ;
44
44
45
- equals ( add ( 1 , 2 , 3 , 4 , 5 ) , 15 , "add 1,2,3,4,5" ) ;
46
- equals ( add ( 4 , 7 , - 2 ) , 9 , "add 4,7,-2" ) ;
45
+ equal ( 15 , add ( 1 , 2 , 3 , 4 , 5 ) , "add 1,2,3,4,5" ) ;
46
+ equal ( 9 , add ( 4 , 7 , - 2 ) , "add 4,7,-2" ) ;
47
47
} ) ;
48
48
49
49
test ( "using call to invoke function" , function ( ) {
@@ -57,7 +57,7 @@ test("using call to invoke function",function(){
57
57
//function, and the arguments to be sent to the function,multiple arguments are separated by commas.
58
58
var result = invokee . call ( "I am this!" , "Where did it come from?" ) ;
59
59
60
- equals ( result , __ , "what will the value of invokee's this be?" ) ;
60
+ equal ( __ , result , "what will the value of invokee's this be?" ) ;
61
61
} ) ;
62
62
63
63
test ( "using apply to invoke function" , function ( ) {
@@ -70,6 +70,6 @@ test("using apply to invoke function",function(){
70
70
//function and and array of arguments to be passed into the called function.
71
71
var result = invokee . apply ( "I am this!" , [ "I am arg1" , "I am arg2" ] ) ;
72
72
73
- equals ( result , __ , "what will the value of invokee's this be?" ) ;
73
+ equal ( __ , result , "what will the value of invokee's this be?" ) ;
74
74
} ) ;
75
75
0 commit comments