bare-script 3.7.1 → 3.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/include/args.bare +14 -14
- package/lib/include/dataTable.bare +5 -5
- package/lib/include/diff.bare +11 -11
- package/lib/include/forms.bare +28 -28
- package/lib/include/markdownUp.bare +15 -15
- package/lib/include/pager.bare +12 -12
- package/lib/include/unittest.bare +62 -62
- package/lib/include/unittestMock.bare +34 -34
- package/package.json +1 -1
package/lib/include/args.bare
CHANGED
|
@@ -62,7 +62,7 @@ function argsValidate(arguments):
|
|
|
62
62
|
|
|
63
63
|
# Check for duplicate arguments
|
|
64
64
|
if validatedArguments != null:
|
|
65
|
-
argNames =
|
|
65
|
+
argNames = {}
|
|
66
66
|
for argument in arguments:
|
|
67
67
|
name = objectGet(argument, 'name')
|
|
68
68
|
if objectHas(argNames, name):
|
|
@@ -86,7 +86,7 @@ endfunction
|
|
|
86
86
|
# $return: The arguments object
|
|
87
87
|
function argsParse(arguments):
|
|
88
88
|
# Create the arguments object
|
|
89
|
-
args =
|
|
89
|
+
args = {}
|
|
90
90
|
for argument in arguments:
|
|
91
91
|
# Get the argument value
|
|
92
92
|
global = argsGlobalName(argument)
|
|
@@ -119,8 +119,8 @@ endfunction
|
|
|
119
119
|
# $return: The MarkdownUp application URL
|
|
120
120
|
function argsURL(arguments, args, explicit, headerText, url):
|
|
121
121
|
# Get the URL variables
|
|
122
|
-
urlVars =
|
|
123
|
-
argNames =
|
|
122
|
+
urlVars = []
|
|
123
|
+
argNames = {}
|
|
124
124
|
for argument in arguments:
|
|
125
125
|
name = objectGet(argument, 'name')
|
|
126
126
|
type = objectGet(argument, 'type')
|
|
@@ -189,7 +189,7 @@ endfunction
|
|
|
189
189
|
# $arg arguments: The [arguments model](includeModel.html#var.vName='ArgsArguments')
|
|
190
190
|
function argsHelp(arguments):
|
|
191
191
|
# Create the help data
|
|
192
|
-
helpData =
|
|
192
|
+
helpData = []
|
|
193
193
|
anyDefault = false
|
|
194
194
|
anyExplicit = false
|
|
195
195
|
anyDescription = false
|
|
@@ -200,13 +200,13 @@ function argsHelp(arguments):
|
|
|
200
200
|
description = objectGet(argument, 'description')
|
|
201
201
|
|
|
202
202
|
# Add the help data row
|
|
203
|
-
arrayPush(helpData,
|
|
204
|
-
'Variable'
|
|
205
|
-
'Type'
|
|
206
|
-
'Default'
|
|
207
|
-
'Explicit'
|
|
208
|
-
'Description'
|
|
209
|
-
)
|
|
203
|
+
arrayPush(helpData, { \
|
|
204
|
+
'Variable': argsGlobalName(argument), \
|
|
205
|
+
'Type': type, \
|
|
206
|
+
'Default': argsFormatValue(default, type), \
|
|
207
|
+
'Explicit': if(explicit, 'Yes', ''), \
|
|
208
|
+
'Description': if(description != null, description, '') \
|
|
209
|
+
})
|
|
210
210
|
|
|
211
211
|
# Update the "any" field bools
|
|
212
212
|
anyDefault = anyDefault || (default != null)
|
|
@@ -215,7 +215,7 @@ function argsHelp(arguments):
|
|
|
215
215
|
endfor
|
|
216
216
|
|
|
217
217
|
# Render the help table
|
|
218
|
-
helpFields =
|
|
218
|
+
helpFields = ['Variable', 'Type']
|
|
219
219
|
if anyDefault:
|
|
220
220
|
arrayPush(helpFields, 'Default')
|
|
221
221
|
endif
|
|
@@ -225,7 +225,7 @@ function argsHelp(arguments):
|
|
|
225
225
|
if anyDescription:
|
|
226
226
|
arrayPush(helpFields, 'Description')
|
|
227
227
|
endif
|
|
228
|
-
dataTable(helpData,
|
|
228
|
+
dataTable(helpData, {'fields': helpFields})
|
|
229
229
|
endfunction
|
|
230
230
|
|
|
231
231
|
|
|
@@ -92,7 +92,7 @@ function dataTableMarkdown(data, model):
|
|
|
92
92
|
endif
|
|
93
93
|
|
|
94
94
|
# Determine the table fields
|
|
95
|
-
fields =
|
|
95
|
+
fields = []
|
|
96
96
|
modelFields = if(model != null, objectGet(model, 'fields'))
|
|
97
97
|
modelCategories = if(model != null, objectGet(model, 'categories'))
|
|
98
98
|
if modelFields != null || modelCategories != null:
|
|
@@ -116,7 +116,7 @@ function dataTableMarkdown(data, model):
|
|
|
116
116
|
formats = if(model != null, objectGet(model, 'formats'))
|
|
117
117
|
|
|
118
118
|
# Compute the field header widths
|
|
119
|
-
widths =
|
|
119
|
+
widths = {}
|
|
120
120
|
for field in fields:
|
|
121
121
|
fieldWidth = stringLength(field)
|
|
122
122
|
if !objectHas(widths, field) || fieldWidth > objectGet(widths, field):
|
|
@@ -125,9 +125,9 @@ function dataTableMarkdown(data, model):
|
|
|
125
125
|
endfor
|
|
126
126
|
|
|
127
127
|
# Compute the formatted field value strings and widths
|
|
128
|
-
dataFormat =
|
|
128
|
+
dataFormat = []
|
|
129
129
|
for row in data:
|
|
130
|
-
rowFormat =
|
|
130
|
+
rowFormat = {}
|
|
131
131
|
arrayPush(dataFormat, rowFormat)
|
|
132
132
|
for field in fields:
|
|
133
133
|
# Format the value
|
|
@@ -176,7 +176,7 @@ function dataTableMarkdown(data, model):
|
|
|
176
176
|
headerFields = headerFields + '|'
|
|
177
177
|
|
|
178
178
|
# Output the table header
|
|
179
|
-
lines =
|
|
179
|
+
lines = []
|
|
180
180
|
arrayPush(lines, headerFields)
|
|
181
181
|
arrayPush(lines, headerSeparator)
|
|
182
182
|
|
package/lib/include/diff.bare
CHANGED
|
@@ -49,11 +49,11 @@ diffTypes = schemaParse( \
|
|
|
49
49
|
# $arg right: The "right" string or array of strings
|
|
50
50
|
# $return: The array of [difference models](includeModel.html#var.vName='Differences')
|
|
51
51
|
function diffLines(left, right):
|
|
52
|
-
diffs =
|
|
52
|
+
diffs = []
|
|
53
53
|
|
|
54
54
|
# Split the left into an array of lines
|
|
55
55
|
if systemType(left) == 'array':
|
|
56
|
-
leftLines =
|
|
56
|
+
leftLines = []
|
|
57
57
|
for leftPart in left:
|
|
58
58
|
arrayExtend(leftLines, regexSplit(diffRegexLineSplit, leftPart))
|
|
59
59
|
endfor
|
|
@@ -63,7 +63,7 @@ function diffLines(left, right):
|
|
|
63
63
|
|
|
64
64
|
# Split the right into an array of lines
|
|
65
65
|
if systemType(right) == 'array':
|
|
66
|
-
rightLines =
|
|
66
|
+
rightLines = []
|
|
67
67
|
for rightPart in right:
|
|
68
68
|
arrayExtend(rightLines, regexSplit(diffRegexLineSplit, rightPart))
|
|
69
69
|
endfor
|
|
@@ -80,26 +80,26 @@ function diffLines(left, right):
|
|
|
80
80
|
# If we've run out of lines on either side
|
|
81
81
|
if ixLeft >= leftLength:
|
|
82
82
|
if ixRight < rightLength:
|
|
83
|
-
arrayPush(diffs,
|
|
83
|
+
arrayPush(diffs, {'type': 'Add', 'lines': arraySlice(rightLines, ixRight)})
|
|
84
84
|
endif
|
|
85
85
|
break
|
|
86
86
|
endif
|
|
87
87
|
if ixRight >= rightLength:
|
|
88
88
|
if ixLeft < leftLength:
|
|
89
|
-
arrayPush(diffs,
|
|
89
|
+
arrayPush(diffs, {'type': 'Remove', 'lines': arraySlice(leftLines, ixLeft)})
|
|
90
90
|
endif
|
|
91
91
|
break
|
|
92
92
|
endif
|
|
93
93
|
|
|
94
94
|
# Find consecutive identical lines
|
|
95
|
-
identicalLines =
|
|
95
|
+
identicalLines = []
|
|
96
96
|
while ixLeft < leftLength && ixRight < rightLength && arrayGet(leftLines, ixLeft) == arrayGet(rightLines, ixRight):
|
|
97
97
|
arrayPush(identicalLines, arrayGet(leftLines, ixLeft))
|
|
98
98
|
ixLeft = ixLeft + 1
|
|
99
99
|
ixRight = ixRight + 1
|
|
100
100
|
endwhile
|
|
101
101
|
if identicalLines:
|
|
102
|
-
arrayPush(diffs,
|
|
102
|
+
arrayPush(diffs, {'type': 'Identical', 'lines': identicalLines})
|
|
103
103
|
continue
|
|
104
104
|
endif
|
|
105
105
|
|
|
@@ -124,11 +124,11 @@ function diffLines(left, right):
|
|
|
124
124
|
# If no match found, use remaining lines
|
|
125
125
|
if !foundMatch:
|
|
126
126
|
if ixLeft < leftLength:
|
|
127
|
-
arrayPush(diffs,
|
|
127
|
+
arrayPush(diffs, {'type': 'Remove', 'lines': arraySlice(leftLines, ixLeft)})
|
|
128
128
|
ixLeft = leftLength
|
|
129
129
|
endif
|
|
130
130
|
if ixRight < rightLength:
|
|
131
|
-
arrayPush(diffs,
|
|
131
|
+
arrayPush(diffs, {'type': 'Add', 'lines': arraySlice(rightLines, ixRight)})
|
|
132
132
|
ixRight = rightLength
|
|
133
133
|
endif
|
|
134
134
|
continue
|
|
@@ -136,13 +136,13 @@ function diffLines(left, right):
|
|
|
136
136
|
|
|
137
137
|
# Add removed lines if any
|
|
138
138
|
if ixLeftTmp > ixLeft:
|
|
139
|
-
arrayPush(diffs,
|
|
139
|
+
arrayPush(diffs, {'type': 'Remove', 'lines': arraySlice(leftLines, ixLeft, ixLeftTmp)})
|
|
140
140
|
ixLeft = ixLeftTmp
|
|
141
141
|
endif
|
|
142
142
|
|
|
143
143
|
# Add added lines if any
|
|
144
144
|
if ixRightTmp > ixRight:
|
|
145
|
-
arrayPush(diffs,
|
|
145
|
+
arrayPush(diffs, {'type': 'Add', 'lines': arraySlice(rightLines, ixRight, ixRightTmp)})
|
|
146
146
|
ixRight = ixRightTmp
|
|
147
147
|
endif
|
|
148
148
|
endwhile
|
package/lib/include/forms.bare
CHANGED
|
@@ -18,18 +18,18 @@ formsSentinel = true
|
|
|
18
18
|
# $arg onEnter: Optional (default is null). The text input element on-enter event handler
|
|
19
19
|
# $return: The text input [element model](https://github.com/craigahobbs/element-model#readme)
|
|
20
20
|
function formsTextElements(id, text, size, onEnter):
|
|
21
|
-
return
|
|
22
|
-
'html'
|
|
23
|
-
'attr'
|
|
24
|
-
'autocomplete'
|
|
25
|
-
'id'
|
|
26
|
-
'style'
|
|
27
|
-
'type'
|
|
28
|
-
'value'
|
|
29
|
-
'size'
|
|
30
|
-
|
|
31
|
-
'callback'
|
|
32
|
-
|
|
21
|
+
return { \
|
|
22
|
+
'html': 'input', \
|
|
23
|
+
'attr': { \
|
|
24
|
+
'autocomplete': 'off', \
|
|
25
|
+
'id': id, \
|
|
26
|
+
'style': 'font-size: inherit; border: thin solid black; padding: 0.4em;', \
|
|
27
|
+
'type': 'text', \
|
|
28
|
+
'value': text, \
|
|
29
|
+
'size': size \
|
|
30
|
+
}, \
|
|
31
|
+
'callback': if(onEnter != null, {'keyup': systemPartial(formsTextOnKeyup, onEnter)}) \
|
|
32
|
+
}
|
|
33
33
|
endfunction
|
|
34
34
|
|
|
35
35
|
|
|
@@ -47,12 +47,12 @@ endfunction
|
|
|
47
47
|
# $arg onClick: The link button's click event handler
|
|
48
48
|
# $return: The link button [element model](https://github.com/craigahobbs/element-model#readme)
|
|
49
49
|
function formsLinkButtonElements(text, onClick):
|
|
50
|
-
return
|
|
51
|
-
'html'
|
|
52
|
-
'attr'
|
|
53
|
-
'elem'
|
|
54
|
-
'callback'
|
|
55
|
-
|
|
50
|
+
return { \
|
|
51
|
+
'html': 'a', \
|
|
52
|
+
'attr': {'style': 'cursor: pointer; user-select: none;'}, \
|
|
53
|
+
'elem': {'text': text}, \
|
|
54
|
+
'callback': {'click': onClick} \
|
|
55
|
+
}
|
|
56
56
|
endfunction
|
|
57
57
|
|
|
58
58
|
|
|
@@ -64,16 +64,16 @@ endfunction
|
|
|
64
64
|
# $return: The link [element model](https://github.com/craigahobbs/element-model#readme)
|
|
65
65
|
function formsLinkElements(text, url):
|
|
66
66
|
if url == null:
|
|
67
|
-
return
|
|
68
|
-
'html'
|
|
69
|
-
'attr'
|
|
70
|
-
'elem'
|
|
71
|
-
|
|
67
|
+
return { \
|
|
68
|
+
'html': 'span', \
|
|
69
|
+
'attr': {'style': 'user-select: none;'}, \
|
|
70
|
+
'elem': {'text': text} \
|
|
71
|
+
}
|
|
72
72
|
endif
|
|
73
73
|
|
|
74
|
-
return
|
|
75
|
-
'html'
|
|
76
|
-
'attr'
|
|
77
|
-
'elem'
|
|
78
|
-
|
|
74
|
+
return { \
|
|
75
|
+
'html': 'a', \
|
|
76
|
+
'attr': {'href': documentURL(url)}, \
|
|
77
|
+
'elem': {'text': text} \
|
|
78
|
+
}
|
|
79
79
|
endfunction
|
|
@@ -21,14 +21,14 @@ markdownUpWindowWidth = 1024
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
# The simulated MarkdownUp state
|
|
24
|
-
markdownUpState =
|
|
25
|
-
'drawingFontSizePx'
|
|
26
|
-
'drawingHeight'
|
|
27
|
-
'drawingWidth'
|
|
28
|
-
'localStorage'
|
|
29
|
-
'sessionStorage'
|
|
30
|
-
'windowClipboard'
|
|
31
|
-
|
|
24
|
+
markdownUpState = { \
|
|
25
|
+
'drawingFontSizePx': markdownUpDefaultFontSizePx, \
|
|
26
|
+
'drawingHeight': 480, \
|
|
27
|
+
'drawingWidth': 640, \
|
|
28
|
+
'localStorage': {}, \
|
|
29
|
+
'sessionStorage': {}, \
|
|
30
|
+
'windowClipboard': '' \
|
|
31
|
+
}
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
#
|
|
@@ -202,7 +202,7 @@ endfunction
|
|
|
202
202
|
|
|
203
203
|
|
|
204
204
|
function localStorageClear():
|
|
205
|
-
objectSet(markdownUpState, 'localStorage',
|
|
205
|
+
objectSet(markdownUpState, 'localStorage', {})
|
|
206
206
|
endfunction
|
|
207
207
|
|
|
208
208
|
|
|
@@ -281,11 +281,11 @@ function schemaElements(types, typeName):
|
|
|
281
281
|
if userTypeKey == 'struct' && objectGet(objectGet(userType, 'struct'), 'union'):
|
|
282
282
|
userTypeKey = 'union'
|
|
283
283
|
endif
|
|
284
|
-
return
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
284
|
+
return [ \
|
|
285
|
+
[ \
|
|
286
|
+
{'html': 'h1', 'elem': {'text': userTypeKey + ' ' + typeName}} \
|
|
287
|
+
] \
|
|
288
|
+
]
|
|
289
289
|
endfunction
|
|
290
290
|
|
|
291
291
|
|
|
@@ -295,7 +295,7 @@ endfunction
|
|
|
295
295
|
|
|
296
296
|
|
|
297
297
|
function sessionStorageClear():
|
|
298
|
-
objectSet(markdownUpState, 'sessionStorage',
|
|
298
|
+
objectSet(markdownUpState, 'sessionStorage', {})
|
|
299
299
|
endfunction
|
|
300
300
|
|
|
301
301
|
|
package/lib/include/pager.bare
CHANGED
|
@@ -97,7 +97,7 @@ endfunction
|
|
|
97
97
|
# $arg options: - **start** - The start page name
|
|
98
98
|
# $arg options: - **keyboard** - Enable keyboard commands ('n' for next, 'p' for previous, 's' for start, 'e' for end)
|
|
99
99
|
async function pagerMain(pagerModel, options):
|
|
100
|
-
options = if(options != null, options,
|
|
100
|
+
options = if(options != null, options, {})
|
|
101
101
|
optionArguments = objectGet(options, 'arguments')
|
|
102
102
|
optionHideMenu = objectGet(options, 'hideMenu')
|
|
103
103
|
optionHideNav = objectGet(options, 'hideNav')
|
|
@@ -154,7 +154,7 @@ async function pagerMain(pagerModel, options):
|
|
|
154
154
|
return
|
|
155
155
|
endif
|
|
156
156
|
else:
|
|
157
|
-
arguments =
|
|
157
|
+
arguments = [{'name': 'page', 'default': startPageName}]
|
|
158
158
|
endif
|
|
159
159
|
args = argsParse(arguments)
|
|
160
160
|
argPage = objectGet(args, 'page')
|
|
@@ -211,7 +211,7 @@ async function pagerMain(pagerModel, options):
|
|
|
211
211
|
|
|
212
212
|
# Render the menu
|
|
213
213
|
if !optionHideMenu:
|
|
214
|
-
menuItems =
|
|
214
|
+
menuItems = []
|
|
215
215
|
for page in pages:
|
|
216
216
|
pageName = objectGet(page, 'name')
|
|
217
217
|
pageHidden = objectGet(page, 'hidden')
|
|
@@ -231,7 +231,7 @@ async function pagerMain(pagerModel, options):
|
|
|
231
231
|
elif pageName == objectGet(curPage, 'name'):
|
|
232
232
|
arrayPush(menuItems, markdownEscape(pageName))
|
|
233
233
|
else:
|
|
234
|
-
arrayPush(menuItems, argsLink(arguments, pageName,
|
|
234
|
+
arrayPush(menuItems, argsLink(arguments, pageName, {'page': pageName}))
|
|
235
235
|
endif
|
|
236
236
|
endfor
|
|
237
237
|
markdownPrint(arrayJoin(menuItems, ' | '), '')
|
|
@@ -239,13 +239,13 @@ async function pagerMain(pagerModel, options):
|
|
|
239
239
|
|
|
240
240
|
# Render the start/next/prev buttons
|
|
241
241
|
if !optionHideNav && (nextPageName != null || prevPageName != null):
|
|
242
|
-
navItems =
|
|
242
|
+
navItems = []
|
|
243
243
|
arrayPush(navItems, \
|
|
244
|
-
if(startPageName != curPageName, argsLink(arguments, 'Start',
|
|
244
|
+
if(startPageName != curPageName, argsLink(arguments, 'Start', {'page': startPageName}), 'Start'))
|
|
245
245
|
arrayPush(navItems, \
|
|
246
|
-
if(prevPageName != null, argsLink(arguments, 'Previous',
|
|
246
|
+
if(prevPageName != null, argsLink(arguments, 'Previous', {'page': prevPageName}), 'Previous'))
|
|
247
247
|
arrayPush(navItems, \
|
|
248
|
-
if(nextPageName != null, argsLink(arguments, 'Next',
|
|
248
|
+
if(nextPageName != null, argsLink(arguments, 'Next', {'page': nextPageName}), 'Next'))
|
|
249
249
|
markdownPrint('( ' + arrayJoin(navItems, ' | ') + ' )', '')
|
|
250
250
|
endif
|
|
251
251
|
|
|
@@ -294,15 +294,15 @@ function pagerKeyDown(arguments, curPageName, startPageName, endPageName, nextPa
|
|
|
294
294
|
key = objectGet(event, 'key')
|
|
295
295
|
if key == 's' && startPageName != curPageName:
|
|
296
296
|
# Start slide
|
|
297
|
-
windowSetLocation(argsURL(arguments,
|
|
297
|
+
windowSetLocation(argsURL(arguments, {'page': startPageName}))
|
|
298
298
|
elif key == 'e' && endPageName != curPageName:
|
|
299
299
|
# End slide
|
|
300
|
-
windowSetLocation(argsURL(arguments,
|
|
300
|
+
windowSetLocation(argsURL(arguments, {'page': endPageName}))
|
|
301
301
|
elif key == 'n' && nextPageName:
|
|
302
302
|
# Next page
|
|
303
|
-
windowSetLocation(argsURL(arguments,
|
|
303
|
+
windowSetLocation(argsURL(arguments, {'page': nextPageName}))
|
|
304
304
|
elif key == 'p' && prevPageName:
|
|
305
305
|
# Previous page
|
|
306
|
-
windowSetLocation(argsURL(arguments,
|
|
306
|
+
windowSetLocation(argsURL(arguments, {'page': prevPageName}))
|
|
307
307
|
endif
|
|
308
308
|
endfunction
|
|
@@ -15,8 +15,8 @@ include <diff.bare>
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
# Test statistics
|
|
18
|
-
unittestTests =
|
|
19
|
-
unittestWarnings =
|
|
18
|
+
unittestTests = {}
|
|
19
|
+
unittestWarnings = []
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
# $function: unittestRunTest
|
|
@@ -60,7 +60,7 @@ function unittestRunTestHelper(testName):
|
|
|
60
60
|
endif
|
|
61
61
|
|
|
62
62
|
# Add the unit test result array
|
|
63
|
-
testFailures =
|
|
63
|
+
testFailures = []
|
|
64
64
|
objectSet(unittestTests, testName, testFailures)
|
|
65
65
|
systemGlobalSet('unittestTestName', testName)
|
|
66
66
|
|
|
@@ -81,7 +81,7 @@ function unittestEqual(actual, expected, description):
|
|
|
81
81
|
|
|
82
82
|
# Add the test failure error lines
|
|
83
83
|
testFailures = objectGet(unittestTests, unittestTestName)
|
|
84
|
-
errorLines =
|
|
84
|
+
errorLines = [ \
|
|
85
85
|
'Equal:', \
|
|
86
86
|
'', \
|
|
87
87
|
'```', \
|
|
@@ -91,9 +91,9 @@ function unittestEqual(actual, expected, description):
|
|
|
91
91
|
'```', \
|
|
92
92
|
jsonStringify(expected), \
|
|
93
93
|
'```' \
|
|
94
|
-
|
|
94
|
+
]
|
|
95
95
|
if description:
|
|
96
|
-
arrayPush(testFailures, arrayExtend(
|
|
96
|
+
arrayPush(testFailures, arrayExtend([markdownEscape(description), ''], errorLines))
|
|
97
97
|
else:
|
|
98
98
|
arrayPush(testFailures, errorLines)
|
|
99
99
|
endif
|
|
@@ -115,8 +115,8 @@ function unittestDeepEqual(actual, expected, description):
|
|
|
115
115
|
endif
|
|
116
116
|
|
|
117
117
|
# Compute the difference lines
|
|
118
|
-
errorLines =
|
|
119
|
-
diffErrorLines =
|
|
118
|
+
errorLines = []
|
|
119
|
+
diffErrorLines = []
|
|
120
120
|
for diff in diffLines(actualJSON, expectedJSON):
|
|
121
121
|
diffType = objectGet(diff, 'type')
|
|
122
122
|
if diffType == 'Remove':
|
|
@@ -130,15 +130,15 @@ function unittestDeepEqual(actual, expected, description):
|
|
|
130
130
|
else:
|
|
131
131
|
# diffType == 'Identical'
|
|
132
132
|
if diffErrorLines:
|
|
133
|
-
arrayExtend(errorLines,
|
|
133
|
+
arrayExtend(errorLines, ['Deep-equal:', '', '```'])
|
|
134
134
|
arrayExtend(errorLines, diffErrorLines)
|
|
135
135
|
arrayPush(errorLines, '```')
|
|
136
|
-
diffErrorLines =
|
|
136
|
+
diffErrorLines = []
|
|
137
137
|
endif
|
|
138
138
|
endif
|
|
139
139
|
endfor
|
|
140
140
|
if diffErrorLines:
|
|
141
|
-
arrayExtend(errorLines,
|
|
141
|
+
arrayExtend(errorLines, ['Deep-equal:', '', '```'])
|
|
142
142
|
arrayExtend(errorLines, diffErrorLines)
|
|
143
143
|
arrayPush(errorLines, '```')
|
|
144
144
|
endif
|
|
@@ -146,7 +146,7 @@ function unittestDeepEqual(actual, expected, description):
|
|
|
146
146
|
# Add the test failure error lines
|
|
147
147
|
testFailures = objectGet(unittestTests, unittestTestName)
|
|
148
148
|
if description:
|
|
149
|
-
arrayPush(testFailures, arrayExtend(
|
|
149
|
+
arrayPush(testFailures, arrayExtend([markdownEscape(description), ''], errorLines))
|
|
150
150
|
else:
|
|
151
151
|
arrayPush(testFailures, errorLines)
|
|
152
152
|
endif
|
|
@@ -210,7 +210,7 @@ function unittestReport(options):
|
|
|
210
210
|
if testNameArg:
|
|
211
211
|
markdownPrint('', argsLink(unittestReportArguments, 'All tests', null, true))
|
|
212
212
|
else:
|
|
213
|
-
markdownPrint('', argsLink(unittestReportArguments, if(hideTests, 'Show', 'Hide') + ' tests',
|
|
213
|
+
markdownPrint('', argsLink(unittestReportArguments, if(hideTests, 'Show', 'Hide') + ' tests', {'hideTests': !hideTests}))
|
|
214
214
|
endif
|
|
215
215
|
endif
|
|
216
216
|
|
|
@@ -227,15 +227,15 @@ function unittestReport(options):
|
|
|
227
227
|
if testFailCount:
|
|
228
228
|
markdownPrint('', '## Failing Tests')
|
|
229
229
|
if hideTests && !isReport && !testNameArg:
|
|
230
|
-
markdownPrint('', argsLink(unittestReportArguments, 'Show',
|
|
230
|
+
markdownPrint('', argsLink(unittestReportArguments, 'Show', {'hideTests': false}))
|
|
231
231
|
endif
|
|
232
232
|
if !hideTests || testNameArg:
|
|
233
233
|
for testName in testNames:
|
|
234
234
|
testFailures = objectGet(unittestTests, testName)
|
|
235
235
|
if arrayLength(testFailures):
|
|
236
236
|
failureLink = if(isReport, testName, \
|
|
237
|
-
argsLink(unittestReportArguments, testName,
|
|
238
|
-
failureLines =
|
|
237
|
+
argsLink(unittestReportArguments, testName, {'test': testName}, false, '_top'))
|
|
238
|
+
failureLines = ['', failureLink + ' - FAIL']
|
|
239
239
|
for errorLines in testFailures:
|
|
240
240
|
for errorLine, ixErrorLine in errorLines:
|
|
241
241
|
if ixErrorLine == 0:
|
|
@@ -256,14 +256,14 @@ function unittestReport(options):
|
|
|
256
256
|
if testPassCount:
|
|
257
257
|
markdownPrint('', '## Passing Tests')
|
|
258
258
|
if hideTests && !isReport && !testNameArg:
|
|
259
|
-
markdownPrint('', argsLink(unittestReportArguments, 'Show',
|
|
259
|
+
markdownPrint('', argsLink(unittestReportArguments, 'Show', {'hideTests': false}))
|
|
260
260
|
endif
|
|
261
261
|
if !hideTests || testNameArg:
|
|
262
262
|
for testName in testNames:
|
|
263
263
|
testFailures = objectGet(unittestTests, testName)
|
|
264
264
|
if !arrayLength(testFailures):
|
|
265
265
|
testLink = if(isReport, testName, \
|
|
266
|
-
argsLink(unittestReportArguments, testName,
|
|
266
|
+
argsLink(unittestReportArguments, testName, {'test': testName}, false, '_top'))
|
|
267
267
|
markdownPrint('', testLink + ' - OK')
|
|
268
268
|
endif
|
|
269
269
|
endfor
|
|
@@ -294,18 +294,18 @@ function unittestReport(options):
|
|
|
294
294
|
for row in coverageData:
|
|
295
295
|
scriptName = objectGet(row, 'Script')
|
|
296
296
|
if !isReport && !stringStartsWith(scriptName, '**'):
|
|
297
|
-
objectSet(row, 'Script', argsLink(unittestReportArguments, scriptName,
|
|
297
|
+
objectSet(row, 'Script', argsLink(unittestReportArguments, scriptName, {"script": scriptName}, false, "_top"))
|
|
298
298
|
endif
|
|
299
299
|
objectSet(row, 'Coverage', numberToFixed(objectGet(row, 'Coverage'), 1) + '%')
|
|
300
300
|
endfor
|
|
301
|
-
markdownPrint('', dataTableMarkdown(coverageData,
|
|
302
|
-
'fields'
|
|
303
|
-
'formats'
|
|
304
|
-
'Statements'
|
|
305
|
-
'Missing'
|
|
306
|
-
'Coverage'
|
|
307
|
-
|
|
308
|
-
))
|
|
301
|
+
markdownPrint('', dataTableMarkdown(coverageData, { \
|
|
302
|
+
'fields': ['Script', 'Statements', 'Missing', 'Coverage'], \
|
|
303
|
+
'formats': { \
|
|
304
|
+
'Statements': {'align': 'right'}, \
|
|
305
|
+
'Missing': {'align': 'right'}, \
|
|
306
|
+
'Coverage': {'align': 'right'} \
|
|
307
|
+
} \
|
|
308
|
+
}))
|
|
309
309
|
else:
|
|
310
310
|
markdownPrint('', '*No data.*')
|
|
311
311
|
endif
|
|
@@ -317,12 +317,12 @@ endfunction
|
|
|
317
317
|
|
|
318
318
|
|
|
319
319
|
# unittestReport application arguments
|
|
320
|
-
unittestReportArguments = argsValidate(
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
)
|
|
320
|
+
unittestReportArguments = argsValidate([ \
|
|
321
|
+
{'name': 'test', 'global': 'vUnittestTest'}, \
|
|
322
|
+
{'name': 'script', 'global': 'vUnittestScript'}, \
|
|
323
|
+
{'name': 'hideTests', 'global': 'vUnittestHideTests', 'type': 'bool', 'default': false}, \
|
|
324
|
+
{'name': 'report', 'global': 'vUnittestReport', 'type': 'bool', 'default': false} \
|
|
325
|
+
])
|
|
326
326
|
|
|
327
327
|
|
|
328
328
|
# Render the script coverage details page
|
|
@@ -331,7 +331,7 @@ function unittestReportScript(scriptName):
|
|
|
331
331
|
title = scriptName + ' Coverage'
|
|
332
332
|
documentSetTitle(title)
|
|
333
333
|
markdownPrint( \
|
|
334
|
-
argsLink(unittestReportArguments, 'Back',
|
|
334
|
+
argsLink(unittestReportArguments, 'Back', {'script': null}, false, '_top'), \
|
|
335
335
|
'', \
|
|
336
336
|
'# ' + markdownEscape(title) \
|
|
337
337
|
)
|
|
@@ -349,7 +349,7 @@ function unittestReportScript(scriptName):
|
|
|
349
349
|
scriptLines = objectGet(script, 'scriptLines')
|
|
350
350
|
|
|
351
351
|
# Mark the statements covered or not-covered
|
|
352
|
-
lineColors =
|
|
352
|
+
lineColors = {}
|
|
353
353
|
statements = unittestScriptStatements(script)
|
|
354
354
|
for statement in statements:
|
|
355
355
|
statementKey = arrayGet(objectKeys(statement), 0)
|
|
@@ -369,9 +369,9 @@ function unittestReportScript(scriptName):
|
|
|
369
369
|
endfor
|
|
370
370
|
|
|
371
371
|
# Generate the code coverage details
|
|
372
|
-
codeLineElements =
|
|
373
|
-
codeElements =
|
|
374
|
-
currentLines =
|
|
372
|
+
codeLineElements = []
|
|
373
|
+
codeElements = {'html': 'pre', 'elem': codeLineElements}
|
|
374
|
+
currentLines = []
|
|
375
375
|
currentColor = null
|
|
376
376
|
for line, ixLine in scriptLines:
|
|
377
377
|
# Accumulate lines of the same color
|
|
@@ -383,7 +383,7 @@ function unittestReportScript(scriptName):
|
|
|
383
383
|
|
|
384
384
|
# Render the current lines
|
|
385
385
|
unittestReportScriptLines(codeLineElements, currentLines, currentColor)
|
|
386
|
-
currentLines =
|
|
386
|
+
currentLines = [line]
|
|
387
387
|
currentColor = lineColor
|
|
388
388
|
endfor
|
|
389
389
|
unittestReportScriptLines(codeLineElements, currentLines, currentColor, true)
|
|
@@ -395,13 +395,13 @@ function unittestReportScriptLines(codeLineElements, lines, color, noNewline):
|
|
|
395
395
|
if lines:
|
|
396
396
|
linesStr = arrayJoin(lines, stringFromCharCode(10)) + if(noNewline, '', stringFromCharCode(10))
|
|
397
397
|
if !color:
|
|
398
|
-
arrayPush(codeLineElements,
|
|
398
|
+
arrayPush(codeLineElements, {'text': linesStr})
|
|
399
399
|
else:
|
|
400
|
-
arrayPush(codeLineElements,
|
|
401
|
-
'html'
|
|
402
|
-
'attr'
|
|
403
|
-
'elem'
|
|
404
|
-
)
|
|
400
|
+
arrayPush(codeLineElements, { \
|
|
401
|
+
'html': 'span', \
|
|
402
|
+
'attr': {'style': 'display: block; background-color: ' + color}, \
|
|
403
|
+
'elem': {'text': linesStr} \
|
|
404
|
+
})
|
|
405
405
|
endif
|
|
406
406
|
endif
|
|
407
407
|
endfunction
|
|
@@ -409,14 +409,14 @@ endfunction
|
|
|
409
409
|
|
|
410
410
|
# Get the coverage data table - columns are "Script", "Statement", "Covered", and "Percent"
|
|
411
411
|
function unittestCoverageData(coverageExclude):
|
|
412
|
-
data =
|
|
412
|
+
data = []
|
|
413
413
|
|
|
414
414
|
# Get the global coverage object
|
|
415
415
|
coverage = coverageGlobalGet()
|
|
416
416
|
if coverage:
|
|
417
417
|
# Get the script names with coverage data
|
|
418
418
|
scripts = objectGet(coverage, 'scripts')
|
|
419
|
-
scriptNames = if(scripts, arraySort(objectKeys(scripts)),
|
|
419
|
+
scriptNames = if(scripts, arraySort(objectKeys(scripts)), [])
|
|
420
420
|
|
|
421
421
|
# Compute script statement coverage
|
|
422
422
|
totalStatements = 0
|
|
@@ -458,25 +458,25 @@ function unittestCoverageData(coverageExclude):
|
|
|
458
458
|
|
|
459
459
|
# Add the script coverage data row
|
|
460
460
|
coveragePercent = if(statementCount, 100 * (statementCount - missingCount) / statementCount, 100)
|
|
461
|
-
arrayPush(data,
|
|
462
|
-
'Script'
|
|
463
|
-
'Statements'
|
|
464
|
-
'Missing'
|
|
465
|
-
'Coverage'
|
|
466
|
-
'CoverageStr'
|
|
467
|
-
)
|
|
461
|
+
arrayPush(data, { \
|
|
462
|
+
'Script': scriptName, \
|
|
463
|
+
'Statements': statementCount, \
|
|
464
|
+
'Missing': missingCount, \
|
|
465
|
+
'Coverage': coveragePercent, \
|
|
466
|
+
'CoverageStr': numberToFixed(coveragePercent, 1) + '%' \
|
|
467
|
+
})
|
|
468
468
|
endfor
|
|
469
469
|
|
|
470
470
|
# Add the coverage totals data row
|
|
471
471
|
if scriptNames:
|
|
472
472
|
coveragePercent = if(totalStatements, 100 * (totalStatements - totalMissing) / totalStatements, 100)
|
|
473
|
-
arrayPush(data,
|
|
474
|
-
'Script'
|
|
475
|
-
'Statements'
|
|
476
|
-
'Missing'
|
|
477
|
-
'Coverage'
|
|
478
|
-
'CoverageStr'
|
|
479
|
-
)
|
|
473
|
+
arrayPush(data, { \
|
|
474
|
+
'Script': '**Total**', \
|
|
475
|
+
'Statements': totalStatements, \
|
|
476
|
+
'Missing': totalMissing, \
|
|
477
|
+
'Coverage': coveragePercent, \
|
|
478
|
+
'CoverageStr': numberToFixed(coveragePercent, 1) + '%' \
|
|
479
|
+
})
|
|
480
480
|
endif
|
|
481
481
|
endif
|
|
482
482
|
|
|
@@ -486,7 +486,7 @@ endfunction
|
|
|
486
486
|
|
|
487
487
|
# Get a script's array of statements
|
|
488
488
|
function unittestScriptStatements(script):
|
|
489
|
-
statements =
|
|
489
|
+
statements = []
|
|
490
490
|
|
|
491
491
|
# Add the top-level script statements
|
|
492
492
|
for statement in objectGet(script, 'statements'):
|
|
@@ -18,16 +18,16 @@ unittestMockWindowWidth = 1024
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
# The mocked MarkdownUp state
|
|
21
|
-
unittestMockCalls =
|
|
22
|
-
unittestMockFunctions =
|
|
23
|
-
unittestMockStateDefault =
|
|
24
|
-
'drawingFontSizePx'
|
|
25
|
-
'drawingHeight'
|
|
26
|
-
'drawingWidth'
|
|
27
|
-
'localStorage'
|
|
28
|
-
'sessionStorage'
|
|
29
|
-
'windowClipboard'
|
|
30
|
-
|
|
21
|
+
unittestMockCalls = []
|
|
22
|
+
unittestMockFunctions = {}
|
|
23
|
+
unittestMockStateDefault = { \
|
|
24
|
+
'drawingFontSizePx': unittestMockDefaultFontSizePx, \
|
|
25
|
+
'drawingHeight': 480, \
|
|
26
|
+
'drawingWidth': 640, \
|
|
27
|
+
'localStorage': {}, \
|
|
28
|
+
'sessionStorage': {}, \
|
|
29
|
+
'windowClipboard': '' \
|
|
30
|
+
}
|
|
31
31
|
unittestMockState = objectCopy(unittestMockStateDefault)
|
|
32
32
|
|
|
33
33
|
|
|
@@ -145,7 +145,7 @@ endfunction
|
|
|
145
145
|
|
|
146
146
|
function unittestMockGeneric(funcName, args...):
|
|
147
147
|
# Record the mocked function call
|
|
148
|
-
arrayPush(unittestMockCalls,
|
|
148
|
+
arrayPush(unittestMockCalls, [funcName, args])
|
|
149
149
|
endfunction
|
|
150
150
|
|
|
151
151
|
|
|
@@ -161,8 +161,8 @@ function unittestMockEnd():
|
|
|
161
161
|
|
|
162
162
|
# Reset the mock state
|
|
163
163
|
mockCalls = unittestMockCalls
|
|
164
|
-
systemGlobalSet('unittestMockCalls',
|
|
165
|
-
systemGlobalSet('unittestMockFunctions',
|
|
164
|
+
systemGlobalSet('unittestMockCalls', [])
|
|
165
|
+
systemGlobalSet('unittestMockFunctions', {})
|
|
166
166
|
systemGlobalSet('unittestMockState', objectCopy(unittestMockStateDefault))
|
|
167
167
|
|
|
168
168
|
return mockCalls
|
|
@@ -183,7 +183,7 @@ function unittestMock_documentInputValue(data, args...):
|
|
|
183
183
|
id = arrayGet(args, 0)
|
|
184
184
|
|
|
185
185
|
# Record the mocked function call
|
|
186
|
-
arrayPush(unittestMockCalls,
|
|
186
|
+
arrayPush(unittestMockCalls, ['documentInputValue', args])
|
|
187
187
|
|
|
188
188
|
# Return the mocked documentInputValue response
|
|
189
189
|
return if(data != null, objectGet(data, id))
|
|
@@ -210,7 +210,7 @@ function unittestMock_drawNew(args...):
|
|
|
210
210
|
height = arrayGet(args, 1)
|
|
211
211
|
|
|
212
212
|
# Record the mocked function call
|
|
213
|
-
arrayPush(unittestMockCalls,
|
|
213
|
+
arrayPush(unittestMockCalls, ['drawNew', args])
|
|
214
214
|
|
|
215
215
|
# Update the mock state
|
|
216
216
|
objectSet(unittestMockState, 'drawingWidth', width)
|
|
@@ -230,7 +230,7 @@ function unittestMock_drawTextStyle(args...):
|
|
|
230
230
|
fontSizePx = arrayGet(args, 0)
|
|
231
231
|
|
|
232
232
|
# Record the mocked function call
|
|
233
|
-
arrayPush(unittestMockCalls,
|
|
233
|
+
arrayPush(unittestMockCalls, ['drawTextStyle', args])
|
|
234
234
|
|
|
235
235
|
# Update the mock state
|
|
236
236
|
objectSet(unittestMockState, 'drawingFontSizePx', if(fontSizePx != null, fontSizePx, unittestMockDefaultFontSizePx))
|
|
@@ -254,10 +254,10 @@ endfunction
|
|
|
254
254
|
|
|
255
255
|
function unittestMock_localStorageClear(args...):
|
|
256
256
|
# Record the mocked function call
|
|
257
|
-
arrayPush(unittestMockCalls,
|
|
257
|
+
arrayPush(unittestMockCalls, ['localStorageClear', args])
|
|
258
258
|
|
|
259
259
|
# Update the mock state
|
|
260
|
-
objectSet(unittestMockState, 'localStorage',
|
|
260
|
+
objectSet(unittestMockState, 'localStorage', {})
|
|
261
261
|
endfunction
|
|
262
262
|
|
|
263
263
|
|
|
@@ -270,7 +270,7 @@ function unittestMock_localStorageRemove(args...):
|
|
|
270
270
|
key = arrayGet(args, 0)
|
|
271
271
|
|
|
272
272
|
# Record the mocked function call
|
|
273
|
-
arrayPush(unittestMockCalls,
|
|
273
|
+
arrayPush(unittestMockCalls, ['localStorageRemove', args])
|
|
274
274
|
|
|
275
275
|
# Update the mock state
|
|
276
276
|
objectDelete(objectGet(unittestMockState, 'localStorage'), key)
|
|
@@ -282,7 +282,7 @@ function unittestMock_localStorageSet(args...):
|
|
|
282
282
|
value = arrayGet(args, 1)
|
|
283
283
|
|
|
284
284
|
# Record the mocked function call
|
|
285
|
-
arrayPush(unittestMockCalls,
|
|
285
|
+
arrayPush(unittestMockCalls, ['localStorageSet', args])
|
|
286
286
|
|
|
287
287
|
# Update the mock state
|
|
288
288
|
objectSet(objectGet(unittestMockState, 'localStorage'), key, value)
|
|
@@ -317,7 +317,7 @@ unittestMock_markdownHeaderId_dash = regexNew('[^a-z0-9]+')
|
|
|
317
317
|
|
|
318
318
|
function unittestMock_markdownParse(data, args...):
|
|
319
319
|
# Record the mocked function call
|
|
320
|
-
arrayPush(unittestMockCalls,
|
|
320
|
+
arrayPush(unittestMockCalls, ['markdownParse', args])
|
|
321
321
|
|
|
322
322
|
# Return the mocked markdownParse response
|
|
323
323
|
return if(data != null, arrayShift(data))
|
|
@@ -326,7 +326,7 @@ endfunction
|
|
|
326
326
|
|
|
327
327
|
function unittestMock_markdownTitle(data, args...):
|
|
328
328
|
# Record the mocked function call
|
|
329
|
-
arrayPush(unittestMockCalls,
|
|
329
|
+
arrayPush(unittestMockCalls, ['markdownTitle', args])
|
|
330
330
|
|
|
331
331
|
# Return the mocked markdownTitle response
|
|
332
332
|
return if(data != null, arrayShift(data))
|
|
@@ -344,11 +344,11 @@ function unittestMock_schemaElements(types, typeName):
|
|
|
344
344
|
if userTypeKey == 'struct' && objectGet(objectGet(userType, 'struct'), 'union'):
|
|
345
345
|
userTypeKey = 'union'
|
|
346
346
|
endif
|
|
347
|
-
return
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
347
|
+
return [ \
|
|
348
|
+
[ \
|
|
349
|
+
{'html': 'h1', 'elem': {'text': userTypeKey + ' ' + typeName}} \
|
|
350
|
+
] \
|
|
351
|
+
]
|
|
352
352
|
endfunction
|
|
353
353
|
|
|
354
354
|
|
|
@@ -359,10 +359,10 @@ endfunction
|
|
|
359
359
|
|
|
360
360
|
function unittestMock_sessionStorageClear(args...):
|
|
361
361
|
# Record the mocked function call
|
|
362
|
-
arrayPush(unittestMockCalls,
|
|
362
|
+
arrayPush(unittestMockCalls, ['sessionStorageClear', args])
|
|
363
363
|
|
|
364
364
|
# Update the mock state
|
|
365
|
-
objectSet(unittestMockState, 'sessionStorage',
|
|
365
|
+
objectSet(unittestMockState, 'sessionStorage', {})
|
|
366
366
|
endfunction
|
|
367
367
|
|
|
368
368
|
|
|
@@ -375,7 +375,7 @@ function unittestMock_sessionStorageRemove(args...):
|
|
|
375
375
|
key = arrayGet(args, 0)
|
|
376
376
|
|
|
377
377
|
# Record the mocked function call
|
|
378
|
-
arrayPush(unittestMockCalls,
|
|
378
|
+
arrayPush(unittestMockCalls, ['sessionStorageRemove', args])
|
|
379
379
|
|
|
380
380
|
# Update the mock state
|
|
381
381
|
objectDelete(objectGet(unittestMockState, 'sessionStorage'), key)
|
|
@@ -387,7 +387,7 @@ function unittestMock_sessionStorageSet(args...):
|
|
|
387
387
|
value = arrayGet(args, 1)
|
|
388
388
|
|
|
389
389
|
# Record the mocked function call
|
|
390
|
-
arrayPush(unittestMockCalls,
|
|
390
|
+
arrayPush(unittestMockCalls, ['sessionStorageSet', args])
|
|
391
391
|
|
|
392
392
|
# Update the mock state
|
|
393
393
|
objectSet(objectGet(unittestMockState, 'sessionStorage'), key, value)
|
|
@@ -403,12 +403,12 @@ function unittestMock_systemFetch(data, args...):
|
|
|
403
403
|
url = arrayGet(args, 0)
|
|
404
404
|
|
|
405
405
|
# Record the mocked function call
|
|
406
|
-
arrayPush(unittestMockCalls,
|
|
406
|
+
arrayPush(unittestMockCalls, ['systemFetch', args])
|
|
407
407
|
|
|
408
408
|
# Array of URLs?
|
|
409
409
|
urlType = systemType(url)
|
|
410
410
|
if urlType == 'array':
|
|
411
|
-
result =
|
|
411
|
+
result = []
|
|
412
412
|
for urlItem in url:
|
|
413
413
|
urlActual = if(systemType(urlItem) == 'object', objectGet(urlItem, 'url'), urlItem)
|
|
414
414
|
arrayPush(result, if(data != null, objectGet(data, urlActual)))
|
|
@@ -446,7 +446,7 @@ function unittestMock_windowClipboardWrite(args...):
|
|
|
446
446
|
text = arrayGet(args, 0)
|
|
447
447
|
|
|
448
448
|
# Record the mocked function call
|
|
449
|
-
arrayPush(unittestMockCalls,
|
|
449
|
+
arrayPush(unittestMockCalls, ['windowClipboardWrite', args])
|
|
450
450
|
|
|
451
451
|
# Update the mock state
|
|
452
452
|
objectSet(unittestMockState, 'windowClipboard', text)
|