Skip to content

Commit cfeaa2f

Browse files
VibhorCodecianGuptaVibhorCodecianGupta
VibhorCodecianGupta
authored and
VibhorCodecianGupta
committed
added go spec
1 parent 1c30b81 commit cfeaa2f

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ install:
1212
- npm install -D
1313
- docker pull codingblocks/judge-worker-c
1414
- docker pull codingblocks/judge-worker-cpp
15+
- docker pull codingblocks/judge-worker-golang
1516
- docker pull codingblocks/judge-worker-java8
1617
- docker pull codingblocks/judge-worker-py2
1718
- docker pull codingblocks/judge-worker-py3

config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ exports = module.exports = {
4848
SOURCE_FILE: 'script.rb',
4949
CPU_SHARE: "0.8",
5050
MEM_LIMIT: '300m'
51+
},
52+
'golang': {
53+
SOURCE_FILE: 'main.go',
54+
CPU_SHARE: "0.8",
55+
MEM_LIMIT: '300m'
5156
}
5257
}
53-
}
58+
}

test/run.go.spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {execRun} from '../src/tasks/run'
2+
import {expect} from 'chai'
3+
4+
describe('run - golang', () => {
5+
it('.go file runs correctly', () => {
6+
execRun({
7+
id: 28,
8+
lang: 'golang',
9+
source: (new Buffer(`
10+
package main;
11+
12+
import "fmt";
13+
14+
func main() {
15+
var text string
16+
fmt.Scanf("%s", &text)
17+
fmt.Println("Hello " + text)
18+
}
19+
20+
`)).toString('base64'),
21+
stdin: (new Buffer('World')).toString('base64')
22+
}, (runResult) => {
23+
expect(new Buffer(runResult.stdout, 'base64').toString('ascii')).to.eq('Hello World')
24+
})
25+
})
26+
})

0 commit comments

Comments
 (0)