-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
48 lines (44 loc) · 1.49 KB
/
index.ts
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
41
42
43
44
45
46
47
48
import { Compiler } from './src/compiler/compiler'
let input = 'Hello Java'
const javaCompiler: Compiler = new Compiler({
compileCommand: 'javac {fileName}',
folder: './__tests__/files/java',
name: 'java',
runCommand: 'java {compiledFileName}',
})
javaCompiler.executionTimeout(3000)
javaCompiler.onInputRequested(input)
javaCompiler.putVariable('fileName', 'Test.java')
javaCompiler.putVariable('compiledFileName', 'Test')
javaCompiler.execute().subscribe((output) => {
console.log(output.data)
console.log('Return: ' + output.returnCode)
console.log('Took: ' + output.took + 'ms')
})
input = 'Hello Python 2'
const pythonCompiler: Compiler = new Compiler({
folder: './__tests__/files/python',
name: 'python',
runCommand: 'python{version} {fileName}',
})
pythonCompiler.putVariable('version', '2')
pythonCompiler.putVariable('fileName', 'Test_python2.py')
pythonCompiler.onInputRequested(input)
pythonCompiler.execute().subscribe((output) => {
console.log(output.data)
console.log('Return: ' + output.returnCode)
console.log('Took: ' + output.took + 'ms')
})
input = 'Hello PHP'
const phpCompiler: Compiler = new Compiler({
folder: './__tests__/files/php',
name: 'php',
runCommand: 'php {fileName}',
})
phpCompiler.putVariable('fileName', 'Test.php')
phpCompiler.onInputRequested(input)
phpCompiler.execute().subscribe((output) => {
console.log(output.data)
console.log('Return: ' + output.returnCode)
console.log('Took: ' + output.took + 'ms')
})