diff --git a/docs/commands.md b/docs/commands.md index 9b147707..d354acc6 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -235,6 +235,7 @@ Display question details. With `-g`/`-l`/`-x`, the code template would be auto g * golang * java * javascript + * kotlin * mysql * php * python @@ -467,7 +468,7 @@ Display version information. Short: $ leetcode version - 2.6.1 + 2.6.2 Verbose: @@ -477,7 +478,7 @@ Verbose: | | ___ ___| |_ ___ ___ __| | ___ | |/ _ \/ _ \ __|/ __|/ _ \ / _` |/ _ \ | | __/ __/ |_ (__| (_) | (_| | __/ - |_|\___|\___|\__|\___|\___/ \__,_|\___| CLI v2.6.1 + |_|\___|\___|\__|\___|\___/ \__,_|\___| CLI v2.6.2 [Environment] Node v8.1.4 diff --git a/docs/releases.md b/docs/releases.md index 7b78a5f3..77cce5eb 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -2,6 +2,10 @@ layout: default title: Release Notes --- +# 2.6.2 +* `submit` + * fixes beta ratio issue + # 2.6.1 * `submit` * fixes 500 error on windows. diff --git a/lib/commands/submit.js b/lib/commands/submit.js index 2209249b..ac6c649c 100644 --- a/lib/commands/submit.js +++ b/lib/commands/submit.js @@ -98,6 +98,7 @@ cmd.handler = function(argv) { // printLine(result, 'Your runtime beats %d %% of %s submissions', // ratio.toFixed(2), lang); // }); + } else { result.testcase = result.testcase.slice(1, -1).replace(/\\n/g, '\n'); printResult(result, 'error'); diff --git a/lib/config.js b/lib/config.js index ed390f04..040d9b33 100644 --- a/lib/config.js +++ b/lib/config.js @@ -29,7 +29,8 @@ const DEFAULT_CONFIG = { 'ruby', 'rust', 'scala', - 'swift' + 'swift', + 'typescript' ], urls: { // base urls diff --git a/lib/helper.js b/lib/helper.js index c4f881aa..d256103e 100644 --- a/lib/helper.js +++ b/lib/helper.js @@ -45,7 +45,8 @@ const LANGS = [ {lang: 'ruby', ext: '.rb', style: '#'}, {lang: 'rust', ext: '.rs', style: 'c'}, {lang: 'scala', ext: '.scala', style: 'c'}, - {lang: 'swift', ext: '.swift', style: 'c'} + {lang: 'swift', ext: '.swift', style: 'c'}, + {lang: 'typescript', ext: '.ts', style: 'c'} ]; const h = {}; diff --git a/test/test_helper.js b/test/test_helper.js index 18a2979d..7f2efabc 100644 --- a/test/test_helper.js +++ b/test/test_helper.js @@ -135,7 +135,7 @@ describe('helper', function() { assert.equal(h.langToExt('rust'), '.rs'); assert.equal(h.langToExt('scala'), '.scala'); assert.equal(h.langToExt('swift'), '.swift'); - assert.equal(h.langToExt('rust'), '.rs'); + assert.equal(h.langToExt('typescript'), '.ts'); }); }); // #langToExt @@ -150,14 +150,15 @@ describe('helper', function() { assert.equal(h.extToLang('~/leetcode/../file.sql'), 'mysql'); assert.equal(h.extToLang('~/leetcode/hello.php'), 'php'); assert.equal(h.extToLang('c:/file.js'), 'javascript'); + assert.equal(h.extToLang('~/leetcode/../file.sql'), 'mysql'); + assert.equal(h.extToLang('~/leetcode/hello.php'), 'php'); assert.equal(h.extToLang('c:/Users/skygragon/file.py'), 'python'); assert.equal(h.extToLang('~/file.rb'), 'ruby'); assert.equal(h.extToLang('~/leetcode/file.rs'), 'rust'); assert.equal(h.extToLang('/tmp/file.scala'), 'scala'); assert.equal(h.extToLang('~/leetcode/file.swift'), 'swift'); - assert.equal(h.extToLang('~/leetcode/../file.sql'), 'mysql'); + // typescript also allowed assert.equal(h.extToLang('/home/skygragon/file.dat'), 'unknown'); - assert.equal(h.extToLang('~/leetcode/file.rs'), 'rust'); }); }); // #extToLang @@ -180,6 +181,7 @@ describe('helper', function() { assert.deepEqual(h.langToCommentStyle('python'), RUBY_STYLE); assert.deepEqual(h.langToCommentStyle('python3'), RUBY_STYLE); assert.deepEqual(h.langToCommentStyle('ruby'), RUBY_STYLE); + assert.deepEqual(h.langToCommentStyle('rust'), C_STYLE); assert.deepEqual(h.langToCommentStyle('scala'), C_STYLE); assert.deepEqual(h.langToCommentStyle('swift'), C_STYLE); });