forked from bigeasy/proof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.js
More file actions
40 lines (40 loc) · 1.25 KB
/
Copy pathparser.js
File metadata and controls
40 lines (40 loc) · 1.25 KB
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
module.exports = {
plan: function (plan) {
var $
if ($ = /^1..(\d+)$/.exec(plan)) {
return { expected: parseInt($[1], 10) }
}
},
bailout: function (bailout) {
var $
if ($ = /^Bail out!(?:\s+(.*))?$/.exec(bailout)) {
return { message: $[1] }
}
},
assertion: function (assert) {
var $, failed, message, ok, comment, skip, todo
if ($ = /^(not\s+)?ok\s+\d+\s*(.*?)\s*$/.exec(assert)) {
failed = $[1], message = $[2]
ok = !failed
comment = null, skip = false, todo = false
if (message != null) {
$ = message.split(/\s+#\s+/, 2), message = $[0], comment = $[1]
if (comment != null) {
if (skip = ($ = /^skip\s(.*)$/i.exec(comment)) != null) {
comment = $[1]
}
if (todo = ($ = /^todo\s(.*)$/i.exec(comment)) != null) {
comment = $[1]
}
}
}
return {
ok: ok,
message: message,
comment: comment,
skip: skip,
todo: todo
}
}
}
}