From 1b5ea18f15b4189c05385e4dc00017128bd54de7 Mon Sep 17 00:00:00 2001 From: sunway Date: Fri, 21 Dec 2018 11:18:42 +0800 Subject: [PATCH] add rust lang --- lib/config.js | 1 + lib/helper.js | 1 + test/test_helper.js | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/config.js b/lib/config.js index 692b958d..cd849fae 100644 --- a/lib/config.js +++ b/lib/config.js @@ -25,6 +25,7 @@ const DEFAULT_CONFIG = { 'python', 'python3', 'ruby', + 'rust', 'scala', 'swift' ], diff --git a/lib/helper.js b/lib/helper.js index 5ca496aa..c2085134 100644 --- a/lib/helper.js +++ b/lib/helper.js @@ -42,6 +42,7 @@ const LANGS = [ {lang: 'python', ext: '.py', style: '#'}, {lang: 'python3', ext: '.py', style: '#'}, {lang: 'ruby', ext: '.rb', style: '#'}, + {lang: 'rust', ext: '.rs', style: 'c'}, {lang: 'scala', ext: '.scala', style: 'c'}, {lang: 'swift', ext: '.swift', style: 'c'} ]; diff --git a/test/test_helper.js b/test/test_helper.js index cfc502d4..6eb6e106 100644 --- a/test/test_helper.js +++ b/test/test_helper.js @@ -133,7 +133,7 @@ describe('helper', function() { assert.equal(h.langToExt('ruby'), '.rb'); assert.equal(h.langToExt('scala'), '.scala'); assert.equal(h.langToExt('swift'), '.swift'); - assert.equal(h.langToExt('rust'), '.raw'); + assert.equal(h.langToExt('rust'), '.rs'); }); }); // #langToExt @@ -152,6 +152,7 @@ describe('helper', function() { assert.equal(h.extToLang('~/leetcode/file.swift'), 'swift'); assert.equal(h.extToLang('~/leetcode/../file.sql'), 'mysql'); assert.equal(h.extToLang('/home/skygragon/file.dat'), 'unknown'); + assert.equal(h.extToLang('~/leetcode/file.rs'), 'rust'); }); }); // #extToLang