Skip to content

Commit e7ff678

Browse files
author
Stephania
committed
Abt str, cont & assign
1 parent 0fac867 commit e7ff678

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

topics/about_assignment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
module("About Assignment (topics/about_assignment.js)");
33

44
test("local variables", function() {
5-
var temp = __;
5+
var temp = 1;
66
equal(temp, 1, "Assign a value to the variable temp");
77
});
88

99
test("global variables", function() {
1010
temp = 1; // Not using var is an example. Always use var in practise.
11-
equal(window.__, temp, 'global variables are assigned to the window object');
11+
equal(1, temp, 'global variables are assigned to the window object');
1212
});

topics/about_control_structures.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ test("if", function() {
55
if (2 > 0) {
66
isPositive = true;
77
}
8-
equal(__, isPositive, 'what is the value of isPositive?');
8+
equal(true, isPositive, 'what is the value of isPositive?');
99
});
1010

1111
test("for", function() {
1212
var counter = 10;
1313
for (var i = 1; i <= 3; i++) {
1414
counter = counter + i;
1515
}
16-
equal(__, counter, 'what is the value of counter?');
16+
equal(16, counter, 'what is the value of counter?');
1717
});
1818

1919
test("for in", function() {
@@ -27,15 +27,15 @@ test("for in", function() {
2727
for (var property_name in person) {
2828
result = result + property_name;
2929
};
30-
equal(__, result, 'what is the value of result?');
30+
equal("nameage", result, 'what is the value of result?');
3131
});
3232

3333
test("ternary operator", function() {
3434
var fruit = true ? "apple" : "orange";
35-
equal(__, fruit, 'what is the value of fruit?');
35+
equal("apple", fruit, 'what is the value of fruit?');
3636

3737
fruit = false ? "apple" : "orange";
38-
equal(__, fruit, 'now what is the value of fruit?');
38+
equal("orange", fruit, 'now what is the value of fruit?');
3939
});
4040

4141
test("switch", function() {
@@ -48,7 +48,7 @@ test("switch", function() {
4848
result = 2;
4949
break;
5050
}
51-
equal(__, result, 'what is the value of result?');
51+
equal(1+1, result, 'what is the value of result?');
5252
});
5353

5454
test("switch default case", function() {
@@ -64,10 +64,10 @@ test("switch default case", function() {
6464
result = "Merry";
6565
break;
6666
}
67-
equal(__, result, 'what is the value of result?');
67+
equal("Merry", result, 'what is the value of result?');
6868
});
6969

7070
test("null coalescing", function() {
7171
var result = null || "a value";
72-
equal(__, result, 'what is the value of result?');
72+
equal("a value", result, 'what is the value of result?');
7373
});

topics/about_strings.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@ module("About Strings (topics/about_strings.js)");
44
test("delimiters", function() {
55
var singleQuotedString = 'apple';
66
var doubleQuotedString = "apple";
7-
equal(__, singleQuotedString === doubleQuotedString, 'are the two strings equal?');
7+
equal(true, singleQuotedString === doubleQuotedString, 'are the two strings equal?');
88
});
99

1010
test("concatenation", function() {
1111
var fruit = "apple";
1212
var dish = "pie";
13-
equal(__, fruit + " " + dish, 'what is the value of fruit + " " + dish?');
13+
equal(apple pie, fruit + " " + dish, 'what is the value of fruit + " " + dish?');
1414
});
1515

1616
test("character Type", function() {
1717
var characterType = typeof("Amory".charAt(1)); // typeof will be explained in about reflection
18-
equal(__, characterType, 'Javascript has no character type');
18+
equal(string, characterType, 'Javascript has no character type');
1919
});
2020

2121
test("escape character", function() {
2222
var stringWithAnEscapedCharacter = "\u0041pple";
23-
equal(__, stringWithAnEscapedCharacter, 'what is the value of stringWithAnEscapedCharacter?');
23+
equal("u0041pple", stringWithAnEscapedCharacter, 'what is the value of stringWithAnEscapedCharacter?');
2424
});
2525

2626
test("string.length", function() {
2727
var fruit = "apple";
28-
equal(__, fruit.length, 'what is the value of fruit.length?');
28+
equal(5, fruit.length, 'what is the value of fruit.length?');
2929
});
3030

3131
test("slice", function() {
3232
var fruit = "apple pie";
33-
equal(__, fruit.slice(0,5), 'what is the value of fruit.slice(0,5)?');
33+
equal(apple, fruit.slice(0,5), 'what is the value of fruit.slice(0,5)?');
3434
});

0 commit comments

Comments
 (0)