From 826f74b8eaa76aa12fc7a8f653f47ecc59406a6d Mon Sep 17 00:00:00 2001 From: VibhorCodecianGupta Date: Thu, 2 Aug 2018 21:01:21 +0530 Subject: [PATCH] rust spec --- config.js | 7 ++++++- test/run.rust.spec.ts | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 test/run.rust.spec.ts diff --git a/config.js b/config.js index e0d814a..2eaed60 100644 --- a/config.js +++ b/config.js @@ -53,6 +53,11 @@ exports = module.exports = { SOURCE_FILE: 'script.rb', CPU_SHARE: "0.8", MEM_LIMIT: '300m' + }, + 'rust': { + SOURCE_FILE: 'script.rs', + CPU_SHARE: "1.2", + MEM_LIMIT: '500m' } } -} \ No newline at end of file +} diff --git a/test/run.rust.spec.ts b/test/run.rust.spec.ts new file mode 100644 index 0000000..5ce488a --- /dev/null +++ b/test/run.rust.spec.ts @@ -0,0 +1,25 @@ +import {execRun} from '../src/tasks/run' +import {expect} from 'chai' + + +describe('run - rust', () => { + it('.rs file runs correctly', () => { + execRun({ + id: 27, + lang: 'rust', + source: (new Buffer(` + use std::io; + fn main() { + let mut input = String::new(); + io::stdin().read_line(&mut input) + .ok() + .expect("Couldn't read line"); + println!("Hello {}", input); + } + `)).toString('base64'), + stdin: (new Buffer('World')).toString('base64') + }, (runResult) => { + expect(new Buffer(runResult.stdout, 'base64').toString('ascii')).to.eq('Hello World\n') + }) + }) +})