Skip to content

Commit

Permalink
Expose assert() function in @EXAMPLE_ARANGOSH_OUTPUT (JS API) examples (
Browse files Browse the repository at this point in the history
  • Loading branch information
Simran-B committed Oct 28, 2022
1 parent c127e47 commit 35e9d73
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Documentation/Scripts/exampleHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ var createErrorMessage = function(err, line, testName, sourceFN, sourceLine, lin
msg + "\n" + err + "\n" + err.stack;
};

var runTestLine = function(line, testName, sourceFN, sourceLine, lineCount, showCmd, expectError, isLoop, fakeVar) {
var runTestLine = function(line, testName, sourceFN, sourceLine, lineCount, showCmd, expectError, isLoop, fakeVar, assert) {
XXX = undefined;
if (showCmd) {
print("arangosh> " + (fakeVar?"var ":"") + line.replace(/\n/g, '\n........> '));
Expand Down
3 changes: 2 additions & 1 deletion utils/generateExamples.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ def generateArangoshOutput(testName):
var outputDir = '%s';
var sourceFile = '%s';
var startTime = time();
var assert = function(a) { globalAssert(a, testName, sourceFile); };
internal.startCaptureMode();
''' % (
('/'*80),
Expand Down Expand Up @@ -435,7 +436,7 @@ def generateArangoshOutput(testName):
l[0] = l[0][4:]
fakeVar = 'true'

print(" runTestLine('%s', testName, sourceFile, %s, lineCount++, %s, %s, %s, %s);" % (
print(" runTestLine('%s', testName, sourceFile, %s, lineCount++, %s, %s, %s, %s, assert);" % (
l[0], # the test string
l[2], # line in the source file
'true' if l[1] else 'false', # Is it visible in the documentation?
Expand Down

0 comments on commit 35e9d73

Please sign in to comment.