File: point.js

package info (click to toggle)
node-tap 12.0.1%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 3,996 kB
  • sloc: javascript: 13,674; sh: 75; makefile: 73
file content (77 lines) | stat: -rw-r--r-- 1,868 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
'use strict'
const t = require('../')
const TestPoint = require('../lib/point.js')

t.throws(_ => new TestPoint(99),
  new TypeError('ok must be boolean'))

t.throws(_ => new TestPoint(true, Math),
  new TypeError('message must be a string'))

const cases = [
  [true, 'this is fine', null, {
    ok: 'ok ',
    message: ' - this is fine\n'
  }],
  [false, 'this is fine', null, {
    ok: 'not ok ',
    message: ' - this is fine\n'
  }],
  [true, '     ', null, {
    ok: 'ok ',
    message: '\n'
  }],
  [false, '\n\r\t\n', null, {
    ok: 'not ok ',
    message: '\n'
  }],
  [true, 'this is fine        ', { skip: true }, {
    ok: 'ok ',
    message: ' - this is fine # SKIP\n'
  }],
  [true, 'this is fine', { skip: 'nope' }, {
    ok: 'ok ',
    message: ' - this is fine # SKIP nope\n'
  }],
  [true, 'this is fine', { todo: true }, {
    ok: 'ok ',
    message: ' - this is fine # TODO\n'
  }],
  [true, 'this is fine', { todo: 'later' }, {
    ok: 'ok ',
    message: ' - this is fine # TODO later\n'
  }],
  [true, 'time waits for no one', { time: 12345 }, {
    ok: 'ok ',
    message: 'time waits for no one # time=12345ms\n'
  }],
  [true, 'fine', { foo: 'bar', diagnostic: true }, {
    ok: 'ok ',
    message: ' - fine\n  ---\n  foo: bar\n  ...\n\n'
  }],
  [true, '', { foo: 'bar', diagnostic: true }, {
    ok: 'ok ',
    message: '\n  ---\n  foo: bar\n  ...\n\n'
  }],
  [false, 'x\ny\r\nz', {}, {
    ok: 'not ok ',
    message: 'x y  z\n'
  }],
  [true, '', {
    tapChildBuffer: 'child output',
    diagnostic: true,
    fluffer: 'nutter'
  }, {
    ok: 'ok ',
    message: '\n  ---\n  fluffer: nutter\n  ...\n{\nchild output\n}\n'
  }],
  [true, '', {
    tapChildBuffer: 'child output',
    fluffer: 'nutter'
  }, {
    ok: 'ok ',
    message: ' {\nchild output\n}\n'
  }],
]

cases.forEach(c => t.match(new TestPoint(c[0], c[1], c[2]), c[3]))