Skip to content

Commit

Permalink
test: case sensitivity of env variables
Browse files Browse the repository at this point in the history
Environment variables should be treated case-insensitive on Windows
platforms and case-sensitive on UNIX platforms.

This commit ensures this behavior persists.

Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #9166
Fixes: #9157
  • Loading branch information
oliversalzburg authored and evanlucas committed Nov 2, 2016
1 parent d1c32aa commit 44427cc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/parallel/test-process-env.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

require('../common');
const common = require('../common');
const assert = require('assert');

// changes in environment should be visible to child processes
Expand Down Expand Up @@ -67,3 +67,17 @@ assert.equal(3, date.getUTCHours());
assert.equal(5, date.getHours());
*/
/* eslint-enable max-len */

// Environment variables should be case-insensitive on Windows, and
// case-sensitive on other platforms.
process.env.TEST = 'test';
assert.strictEqual(process.env.TEST, 'test');
// Check both mixed case and lower case, to avoid any regressions that might
// simply convert input to lower case.
if (common.isWindows) {
assert.strictEqual(process.env.test, 'test');
assert.strictEqual(process.env.teST, 'test');
} else {
assert.strictEqual(process.env.test, undefined);
assert.strictEqual(process.env.teST, undefined);
}

0 comments on commit 44427cc

Please sign in to comment.