]> khamidou — GitHub mirrors - electron.git/commitdiff
spec: Test localeCompare in child process
authorCheng Zhao <zcbenz@gmail.com>
Sat, 17 Jan 2015 00:11:02 +0000 (16:11 -0800)
committerCheng Zhao <zcbenz@gmail.com>
Sat, 17 Jan 2015 00:11:02 +0000 (16:11 -0800)
spec/fixtures/module/locale-compare.js [new file with mode: 0644]
spec/node-spec.coffee

diff --git a/spec/fixtures/module/locale-compare.js b/spec/fixtures/module/locale-compare.js
new file mode 100644 (file)
index 0000000..f99e7c3
--- /dev/null
@@ -0,0 +1,7 @@
+process.on('message', function (msg) {
+  process.send([
+    'a'.localeCompare('a'),
+    'ä'.localeCompare('z', 'de'),
+    'ä'.localeCompare('a', 'sv', { sensitivity: 'base' }),
+  ]);
+});
index 3a2013839f5316ce4bc75c7073775cfb9f28c024..89944683cbdd63cb37c43cec0427422a9c76a829 100644 (file)
@@ -41,6 +41,13 @@ describe 'node feature', ->
           done()
         child.send 'message'
 
+      it 'has String::localeCompare working in script', (done) ->
+        child = child_process.fork path.join(fixtures, 'module', 'locale-compare.js')
+        child.on 'message', (msg) ->
+          assert.deepEqual msg, [0, -1, 1]
+          done()
+        child.send 'message'
+
   describe 'contexts', ->
     describe 'setTimeout in fs callback', ->
       it 'does not crash', (done) ->