-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjtest.js
More file actions
33 lines (30 loc) · 861 Bytes
/
jtest.js
File metadata and controls
33 lines (30 loc) · 861 Bytes
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
const JSONScript = require("./index");
const os = require("os");
const path = require("path");
const fs = require("fs").promises;
const test = [
{
comment:
"Create a C++ source file named 'hello.cpp' with the 'Hello, World!' program.",
file: {
name: "hello.cpp",
data: '#include <iostream>\n\nint main() {\n std::cout << "Hello, World!" << std::endl;\n return 0;\n}\n',
},
},
{
comment:
"Compile the 'hello.cpp' file to create an executable named 'hello'.",
cmd: "g++ hello.cpp -o hello",
},
{
comment:
"Run the 'hello' executable to print 'Hello, World!' to the terminal.",
cmd: "./hello",
},
];
async function testJSONScript() {
const script = new JSONScript(test);
const { results, error } = await script.execute();
console.log(results, error);
}
testJSONScript();