-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathspec_generator.moon
More file actions
38 lines (28 loc) · 1.12 KB
/
spec_generator.moon
File metadata and controls
38 lines (28 loc) · 1.12 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
import int_list from require 'test_helpers'
{
module_name: 'SimpleLinkedList',
generate_test: (case, level) ->
lines = {}
if case.input.initialValues
table.insert lines, "list = SimpleLinkedList #{int_list case.input.initialValues}"
else
table.insert lines, "list = SimpleLinkedList!"
for op in *case.input.operations
if op.value
table.insert lines, "list\\#{op.operation} #{op.value}"
elseif not op.expected
table.insert lines, "list\\#{op.operation}!"
elseif type(op.expected) != 'table'
table.insert lines, "result = list\\#{op.operation}!"
table.insert lines, "assert.are.equal #{op.expected}, result"
elseif op.expected.error
table.insert lines, "f = -> list\\#{op.operation}!"
table.insert lines, "assert.has.error f, #{quote op.expected.error}"
else
table.insert lines, "result = list\\#{op.operation}!"
table.insert lines, "assert.are.same #{int_list op.expected}, result"
table.concat [indent line, level for line in *lines], '\n'
exclusions: {
{key: 'description', value: 'toList LIFO'}
}
}