Skip to content

Commit d508fcd

Browse files
committed
Javascript prototypal inheritance test
1 parent e444214 commit d508fcd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

topics/about_prototypal_inheritance.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Mammal.prototype = {
1616

1717
test("defining a 'class'", function() {
1818
var eric = new Mammal("Eric");
19-
equal(__, eric.sayHi(), 'what will Eric say?');
19+
equal("Hello, my name is Eric", eric.sayHi(), 'what will Eric say?');
2020
});
2121

2222
// add another function to the Mammal 'type' that uses the sayHi function
@@ -26,7 +26,7 @@ Mammal.prototype.favouriteSaying = function() {
2626

2727
test("more functions", function() {
2828
var bobby = new Mammal("Bobby");
29-
equal(__, bobby.favouriteSaying(), "what is Bobby's favourite saying?");
29+
equal("Bobby's favourite saying is Hello, my name is Bobby", bobby.favouriteSaying(), "what is Bobby's favourite saying?");
3030
});
3131

3232
test("calling functions added to a prototype after an object was created", function() {
@@ -36,7 +36,7 @@ test("calling functions added to a prototype after an object was created", funct
3636
};
3737
// the following statement asks the paul object to call a function that was added
3838
// to the Mammal prototype after paul was constructed.
39-
equal(__, paul.numberOfLettersInName(), "how long is Paul's name?");
39+
equal(4, paul.numberOfLettersInName(), "how long is Paul's name?");
4040
});
4141

4242
// helper function for inheritance.
@@ -56,6 +56,6 @@ extend(Bat, Mammal);
5656

5757
test("Inheritance", function() {
5858
var lenny = new Bat("Lenny", "1.5m");
59-
equal(__, lenny.sayHi(), "what does Lenny say?");
60-
equal(__, lenny.wingspan, "what is Lenny's wingspan?");
59+
equal("Hello, my name is Lenny", lenny.sayHi(), "what does Lenny say?");
60+
equal("1.5m", lenny.wingspan, "what is Lenny's wingspan?");
6161
});

0 commit comments

Comments
 (0)