Skip to content

Commit 7fa4fa2

Browse files
committed
Rename __ to FILL_ME_IN to avoid confusion with underscore.js' _()
Signed-off-by: David Laing <[email protected]>
1 parent 6465c2a commit 7fa4fa2

12 files changed

+111
-111
lines changed

KoansRunner.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<script type="text/javascript" src="lib/underscore-min.js"></script>
1212

13-
<script type="text/javascript" src="lib/__.js"></script>
13+
<script type="text/javascript" src="lib/FILL_ME_IN.js"></script>
1414

1515
<script type="text/javascript" src="koans/AboutExpects.js"></script>
1616
<script type="text/javascript" src="koans/AboutArrays.js"></script>

koans/AboutApplyingWhatWeHaveLearnt.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe("About Applying What We Have Learnt", function() {
3232
}
3333
}
3434

35-
expect(productsICanEat.length).toBe(__);
35+
expect(productsICanEat.length).toBe(FILL_ME_IN);
3636
});
3737

3838
it("given I'm allergic to nuts and hate mushrooms, it should find a pizza I can eat (functional)", function () {
@@ -41,7 +41,7 @@ describe("About Applying What We Have Learnt", function() {
4141

4242
/* solve using filter() & all() / any() */
4343

44-
expect(productsICanEat.length).toBe(__);
44+
expect(productsICanEat.length).toBe(FILL_ME_IN);
4545
});
4646

4747
/*********************************************************************************/
@@ -55,14 +55,14 @@ describe("About Applying What We Have Learnt", function() {
5555
}
5656
}
5757

58-
expect(sum).toBe(__);
58+
expect(sum).toBe(FILL_ME_IN);
5959
});
6060

6161
it("should add all the natural numbers below 1000 that are multiples of 3 or 5 (functional)", function () {
6262

63-
var sum = __; /* try chaining range() and reduce() */
63+
var sum = FILL_ME_IN; /* try chaining range() and reduce() */
6464

65-
expect(234168).toBe(__);
65+
expect(234168).toBe(FILL_ME_IN);
6666
});
6767

6868
/*********************************************************************************/
@@ -75,15 +75,15 @@ describe("About Applying What We Have Learnt", function() {
7575
}
7676
}
7777

78-
expect(ingredientCount['mushrooms']).toBe(__);
78+
expect(ingredientCount['mushrooms']).toBe(FILL_ME_IN);
7979
});
8080

8181
it("should count the ingredient occurrence (functional)", function () {
8282
var ingredientCount = { "{ingredient name}": 0 };
8383

8484
/* chain() together map(), flatten() and reduce() */
8585

86-
expect(ingredientCount['mushrooms']).toBe(__);
86+
expect(ingredientCount['mushrooms']).toBe(FILL_ME_IN);
8787
});
8888

8989
/*********************************************************************************/

koans/AboutArrays.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ describe("About Arrays", function() {
33
//We shall contemplate truth by testing reality, via spec expectations.
44
it("should create arrays", function() {
55
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);
88

99
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);
1616
});
1717

1818
it("should understand array literals", function () {
@@ -23,36 +23,36 @@ describe("About Arrays", function() {
2323
expect(array).toEqual([1]);
2424

2525
array[1] = 2;
26-
expect(array).toEqual([1, __]);
26+
expect(array).toEqual([1, FILL_ME_IN]);
2727

2828
array.push(3);
29-
expect(array).toEqual(__);
29+
expect(array).toEqual(FILL_ME_IN);
3030
});
3131

3232
it("should understand array length", function () {
3333
var fourNumberArray = [1, 2, 3, 4];
3434

35-
expect(fourNumberArray.length).toBe(__);
35+
expect(fourNumberArray.length).toBe(FILL_ME_IN);
3636
fourNumberArray.push(5, 6);
37-
expect(fourNumberArray.length).toBe(__);
37+
expect(fourNumberArray.length).toBe(FILL_ME_IN);
3838

3939
var tenEmptyElementArray = new Array(10);
40-
expect(tenEmptyElementArray.length).toBe(__);
40+
expect(tenEmptyElementArray.length).toBe(FILL_ME_IN);
4141

4242
tenEmptyElementArray.length = 5;
43-
expect(tenEmptyElementArray.length).toBe(__);
43+
expect(tenEmptyElementArray.length).toBe(FILL_ME_IN);
4444
});
4545

4646
it("should slice arrays", function () {
4747
var array = ["peanut", "butter", "and", "jelly"];
4848

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);
5656
});
5757

5858
it("should know array references", function () {
@@ -62,36 +62,36 @@ describe("About Arrays", function() {
6262
refArray[1] = "changed in function";
6363
}
6464
passedByReference(array);
65-
expect(array[1]).toBe(__);
65+
expect(array[1]).toBe(FILL_ME_IN);
6666

6767
var assignedArray = array;
6868
assignedArray[5] = "changed in assignedArray";
69-
expect(array[5]).toBe(__);
69+
expect(array[5]).toBe(FILL_ME_IN);
7070

7171
var copyOfArray = array.slice();
7272
copyOfArray[3] = "changed in copyOfArray";
73-
expect(array[3]).toBe(__);
73+
expect(array[3]).toBe(FILL_ME_IN);
7474
});
7575

7676
it("should push and pop", function () {
7777
var array = [1, 2];
7878
array.push(3);
7979

80-
expect(array).toEqual(__);
80+
expect(array).toEqual(FILL_ME_IN);
8181

8282
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);
8585
});
8686

8787
it("should know about shifting arrays", function () {
8888
var array = [1, 2];
8989

9090
array.unshift(3);
91-
expect(array).toEqual(__);
91+
expect(array).toEqual(FILL_ME_IN);
9292

9393
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);
9696
});
9797
});

koans/AboutExpects.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ describe("About Expects", function() {
77

88
//To understand reality, we must compare our expectations against reality.
99
it("should expect equality", function () {
10-
var expectedValue = __;
10+
var expectedValue = FILL_ME_IN;
1111
var actualValue = 1 + 1;
1212

1313
expect(actualValue === expectedValue).toBeTruthy();
1414
});
1515

1616
//Some ways of asserting equality are better than others.
1717
it("should assert equality a better way", function () {
18-
var expectedValue = __;
18+
var expectedValue = FILL_ME_IN;
1919
var actualValue = 1 + 1;
2020

2121
// toEqual() compares using common sense equality.
@@ -24,7 +24,7 @@ describe("About Expects", function() {
2424

2525
//Sometimes you need to be really exact about what you "type".
2626
it("should assert equality with ===", function () {
27-
var expectedValue = __;
27+
var expectedValue = FILL_ME_IN;
2828
var actualValue = (1 + 1).toString();
2929

3030
// toBe() will always use === to compare.
@@ -33,6 +33,6 @@ describe("About Expects", function() {
3333

3434
//Sometimes we will ask you to fill in the values.
3535
it("should have filled in values", function () {
36-
expect(1 + 1).toEqual(__);
36+
expect(1 + 1).toEqual(FILL_ME_IN);
3737
});
3838
});

koans/AboutFunctions.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe("About Functions", function() {
66
return a + b;
77
}
88

9-
expect(add(1, 2)).toBe(__);
9+
expect(add(1, 2)).toBe(FILL_ME_IN);
1010
});
1111

1212
it("should know internal variables override outer variables", function () {
@@ -21,9 +21,9 @@ describe("About Functions", function() {
2121
return message;
2222
}
2323

24-
expect(getMessage()).toBe(__);
25-
expect(overrideMessage()).toBe(__);
26-
expect(message).toBe(__);
24+
expect(getMessage()).toBe(FILL_ME_IN);
25+
expect(overrideMessage()).toBe(FILL_ME_IN);
26+
expect(message).toBe(FILL_ME_IN);
2727
});
2828

2929
it("should have lexical scoping", function () {
@@ -35,7 +35,7 @@ describe("About Functions", function() {
3535
}
3636
return childfunction();
3737
}
38-
expect(parentfunction()).toBe(__);
38+
expect(parentfunction()).toBe(FILL_ME_IN);
3939
});
4040

4141
it("should use lexical scoping to synthesise functions", function () {
@@ -52,7 +52,7 @@ describe("About Functions", function() {
5252
var increaseBy3 = makeIncreaseByFunction(3);
5353
var increaseBy5 = makeIncreaseByFunction(5);
5454

55-
expect(increaseBy3(10) + increaseBy5(10)).toBe(__);
55+
expect(increaseBy3(10) + increaseBy5(10)).toBe(FILL_ME_IN);
5656
});
5757

5858
it("should allow extra function arguments", function () {
@@ -62,14 +62,14 @@ describe("About Functions", function() {
6262
return firstArg;
6363
}
6464

65-
expect(returnFirstArg("first", "second", "third")).toBe(__);
65+
expect(returnFirstArg("first", "second", "third")).toBe(FILL_ME_IN);
6666

6767
function returnSecondArg(firstArg, secondArg)
6868
{
6969
return secondArg;
7070
}
7171

72-
expect(returnSecondArg("only give first arg")).toBe(__);
72+
expect(returnSecondArg("only give first arg")).toBe(FILL_ME_IN);
7373

7474
function returnAllArgs()
7575
{
@@ -80,7 +80,7 @@ describe("About Functions", function() {
8080
return argsArray.join(",");
8181
}
8282

83-
expect(returnAllArgs("first", "second", "third")).toBe(__);
83+
expect(returnAllArgs("first", "second", "third")).toBe(FILL_ME_IN);
8484
});
8585

8686
it("should pass functions as values", function () {
@@ -94,21 +94,21 @@ describe("About Functions", function() {
9494
};
9595

9696
var praiseSinger = { givePraise: appendRules };
97-
expect(praiseSinger.givePraise("John")).toBe(__);
97+
expect(praiseSinger.givePraise("John")).toBe(FILL_ME_IN);
9898

9999
praiseSinger.givePraise = appendDoubleRules;
100-
expect(praiseSinger.givePraise("Mary")).toBe(__);
100+
expect(praiseSinger.givePraise("Mary")).toBe(FILL_ME_IN);
101101

102102
});
103103

104104
it("should use function body as a string", function () {
105105
var add = new Function("a", "b", "return a + b;");
106-
expect(add(1, 2)).toBe(__);
106+
expect(add(1, 2)).toBe(FILL_ME_IN);
107107

108108
var multiply = function (a, b) {
109109
//An internal comment
110110
return a * b;
111111
};
112-
expect(multiply.toString()).toBe(__);
112+
expect(multiply.toString()).toBe(FILL_ME_IN);
113113
});
114114
});

0 commit comments

Comments
 (0)