Skip to content

Commit

Permalink
doc: specify sorted requires in tests
Browse files Browse the repository at this point in the history
And allow anchor links to the various sections, to more easily reference
them when reviewing PRs.

PR-URL: nodejs#10716
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
  • Loading branch information
sam-github authored and italoacasas committed Jan 23, 2017
1 parent 34fe56a commit 19e1220
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions doc/guides/writing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Let's analyze this very basic test from the Node.js test suite:
4 // This test ensures that the http-parser can handle UTF-8 characters
5 // in the http header.
6
7 const http = require('http');
8 const assert = require('assert');
7 const assert = require('assert');
8 const http = require('http');
9
10 const server = http.createServer(common.mustCall((req, res) => {
11 res.end('ok');
Expand All @@ -47,7 +47,7 @@ Let's analyze this very basic test from the Node.js test suite:
21 });
```

**Lines 1-2**
### **Lines 1-2**

```javascript
'use strict';
Expand All @@ -70,7 +70,7 @@ by `common` are used, it can be included without assigning it to an identifier:
require('../common');
```

**Lines 4-5**
### **Lines 4-5**

```javascript
// This test ensures that the http-parser can handle UTF-8 characters
Expand All @@ -80,19 +80,19 @@ require('../common');
A test should start with a comment containing a brief description of what it is
designed to test.

**Lines 7-8**
### **Lines 7-8**

```javascript
const http = require('http');
const assert = require('assert');
const http = require('http');
```

These modules are required for the test to run. Except for special cases, these
modules should only include core modules.
The `assert` module is used by most of the tests to check that the assumptions
for the test are met.

**Lines 10-21**
### **Lines 10-21**

This is the body of the test. This test is quite simple, it just tests that an
HTTP server accepts `non-ASCII` characters in the headers of an incoming
Expand Down

0 comments on commit 19e1220

Please sign in to comment.