Skip to content

Commit 05516de

Browse files
committed
Merge pull request #20 from hanneskaeufler/patch-1
add some more syntax highlighting to README
2 parents d3d0ea0 + e9da5ea commit 05516de

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ sending a pull request for [this issue](https://github.com/testdouble/testdouble
2020

2121
The easiest way to create a test double function is to make one anonymously:
2222

23-
```
23+
``` javascript
2424
var td = require('testdouble');
2525
var myTestDouble = td.create();
2626
```
@@ -32,7 +32,7 @@ In the above, `myTestDouble` will be able to be stubbed or verified as shown bel
3232
For slightly easier-to-understand error messages (with the trade-off of greater
3333
redundancy in your tests), you can supply a string name to `create`
3434

35-
```
35+
``` javascript
3636
var myNamedDouble = td.create("#foo");
3737
```
3838

@@ -66,22 +66,22 @@ respectively.
6666

6767
To stub values with testdouble.js, first create one:
6868

69-
```
69+
``` javascript
7070
var td = require('testdouble');
7171
myTestDouble = td.create();
7272
```
7373

7474
You can stub a no-arg invocation like so:
7575

76-
```
76+
``` javascript
7777
td.when(myTestDouble()).thenReturn("HEY");
7878

7979
myTestDouble(); // returns "HEY"
8080
```
8181

8282
You can stub a specific set of args (performs lodash's `_.isEqual` on each) with:
8383

84-
```
84+
``` javascript
8585
td.when(myTestDouble('a', 5, {foo: 'bar'})).thenReturn("YES");
8686

8787
myTestDouble('a', 5, {foo: 'bar'}); // returns "YES"
@@ -102,15 +102,15 @@ you can use the `verify` function.
102102

103103
First, create a test double:
104104

105-
```
105+
``` javascript
106106
var td = require('testdouble');
107107
var myTestDouble = td.create();
108108
```
109109

110110
Now, suppose you've passed this function into your [subject](https://github.com/testdouble/contributing-tests/wiki/Subject)
111111
and you want to verify that it was called with the arguments `("foo", 5)`:
112112

113-
```
113+
``` javascript
114114
subject.callTheThingThatShouldBeInvokingMyTestDouble()
115115

116116
td.verify(myTestDouble("foo", 5))
@@ -146,7 +146,7 @@ You can see the built-in matchers in the [source](https://github.com/testdouble/
146146

147147
Here's an example usage of the provided `isA()` matcher:
148148

149-
```
149+
``` javascript
150150
var td = require('testdouble');
151151
var myTestDouble = td.create();
152152

@@ -160,7 +160,7 @@ myTestDouble(new String("neato")) // returns "YES"
160160

161161
Matchers can also be used to relax or augment the `verify()` method, like so:
162162

163-
```
163+
``` javascript
164164
verify(myTestDouble(td.matchers.isA(Date)))
165165
```
166166

@@ -223,13 +223,13 @@ you may choose to make a few of the top-level functions global in a test helper
223223
224224
Perhaps you want to keep everything namespaced under `td` for short:
225225
226-
```
226+
``` javascript
227227
global.td = require('testdouble');
228228
```
229229
230230
Or, you might prefer to plop the methods directly on the global:
231231
232-
```
232+
``` javascript
233233
global.double = require('testdouble').create;
234234
global.when = require('testdouble').when;
235235
global.verify = require('testdouble').verify;

0 commit comments

Comments
 (0)