node/deps/npm/node_modules/has-unicode/test/index.js
Rebecca Turner 76cb81b354 deps: upgrade npm to 3.6.0
PR-URL: https://github.com/nodejs/node/pull/4958
Reviewed-By: Myles Borins <mborins@us.ibm.com>
Reviewed-By: Kat Marchán <kzm@sykosomatic.org>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-02-01 10:43:34 -05:00

27 lines
887 B
JavaScript

"use strict"
var test = require("tap").test
var requireInject = require("require-inject")
test("Windows", function (t) {
t.plan(1)
var hasUnicode = requireInject("../index.js", {
os: { type: function () { return "Windows_NT" } }
})
t.is(hasUnicode(), false, "Windows is assumed NOT to be unicode aware")
})
test("Unix Env", function (t) {
t.plan(3)
var hasUnicode = requireInject("../index.js", {
os: { type: function () { return "Linux" } },
child_process: { exec: function (cmd,cb) { cb(new Error("not available")) } }
})
process.env.LANG = "en_US.UTF-8"
process.env.LC_ALL = null
t.is(hasUnicode(), true, "Linux with a UTF8 language")
process.env.LANG = null
process.env.LC_ALL = "en_US.UTF-8"
t.is(hasUnicode(), true, "Linux with UTF8 locale")
process.env.LC_ALL = null
t.is(hasUnicode(), false, "Linux without UTF8 language or locale")
})