@jdeighan/coffee-utils 4.0.23 → 4.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
@@ -0,0 +1,129 @@
1
+ // Generated by CoffeeScript 2.6.1
2
+ // block.test.coffee
3
+ var simple;
4
+
5
+ import assert from 'assert';
6
+
7
+ import {
8
+ UnitTester
9
+ } from '@jdeighan/coffee-utils/test';
10
+
11
+ import {
12
+ blockToArray,
13
+ arrayToBlock,
14
+ firstLine,
15
+ remainingLines,
16
+ normalizeBlock,
17
+ truncateBlock,
18
+ joinBlocks,
19
+ forEachLine,
20
+ forEachBlock,
21
+ forEachSetOfBlocks
22
+ } from '@jdeighan/coffee-utils/block';
23
+
24
+ simple = new UnitTester();
25
+
26
+ // ---------------------------------------------------------------------------
27
+ simple.equal(108, blockToArray("abc\nxyz\n"), ['abc', 'xyz']);
28
+
29
+ simple.equal(113, blockToArray("abc\nxyz\n\n\n\n"), ['abc', 'xyz']);
30
+
31
+ simple.equal(118, blockToArray("abc\n\nxyz\n"), ['abc', '', 'xyz']);
32
+
33
+ // ---------------------------------------------------------------------------
34
+ simple.equal(126, arrayToBlock(['a', 'b', 'c']), "a\nb\nc\n");
35
+
36
+ // ---------------------------------------------------------------------------
37
+ simple.equal(225, firstLine(`#starbucks
38
+ do this
39
+ do that`), '#starbucks');
40
+
41
+ // ---------------------------------------------------------------------------
42
+ simple.equal(225, remainingLines(`#starbucks
43
+ do this
44
+ do that`), `do this
45
+ do that`);
46
+
47
+ // ---------------------------------------------------------------------------
48
+ (function() {
49
+ var str;
50
+ str = joinBlocks('import me', '', 'do this\ndo that');
51
+ return simple.equal(17, str, `import me
52
+ do this
53
+ do that`);
54
+ })();
55
+
56
+ // ---------------------------------------------------------------------------
57
+ simple.equal(49, normalizeBlock(`line 1
58
+ line 2`), `line 1
59
+ line 2` + '\n');
60
+
61
+ simple.equal(57, normalizeBlock(`line 1
62
+
63
+ line 2`), `line 1
64
+ line 2` + '\n');
65
+
66
+ simple.equal(66, normalizeBlock(`
67
+ line 1
68
+
69
+ line 2
70
+
71
+ `), `line 1
72
+ line 2` + '\n');
73
+
74
+ // ---------------------------------------------------------------------------
75
+ simple.equal(96, truncateBlock(`line 1
76
+ line 2
77
+ line 3
78
+ line 4`, 2), `line 1
79
+ line 2` + '\n');
80
+
81
+ // ---------------------------------------------------------------------------
82
+ (function() {
83
+ var lBlocks, str;
84
+ lBlocks = ["import {say} from '@jdeighan/coffee-utils'", "", "<script>\n\tx = 42\n</script>", ""];
85
+ str = joinBlocks(...lBlocks);
86
+ return simple.equal(34, str, `import {say} from '@jdeighan/coffee-utils'
87
+ <script>
88
+ x = 42
89
+ </script>`);
90
+ })();
91
+
92
+ // ---------------------------------------------------------------------------
93
+ (function() {
94
+ var code, lImports, str;
95
+ lImports = ["import {say} from '@jdeighan/coffee-utils'"];
96
+ code = `if (x==42)
97
+ log "line 2 in unit test"`;
98
+ str = joinBlocks(...lImports, code);
99
+ return simple.equal(34, str, `
100
+ import {say} from '@jdeighan/coffee-utils'
101
+ if (x==42)
102
+ log "line 2 in unit test"`);
103
+ })();
104
+
105
+ // ---------------------------------------------------------------------------
106
+ // test forEachLine()
107
+ (async function() {
108
+ var callback, filepath, lLines;
109
+ lLines = [];
110
+ callback = function(line) {
111
+ lLines.push(line);
112
+ };
113
+ filepath = "c:/Users/johnd/coffee-utils/test/data/file2.txt";
114
+ await forEachLine(filepath, callback);
115
+ return simple.equal(55, lLines, ["abc", "def", "ghi", "jkl"]);
116
+ })();
117
+
118
+ // ---------------------------------------------------------------------------
119
+ // test forEachBlock()
120
+ (async function() {
121
+ var callback, filepath, lBlocks;
122
+ lBlocks = [];
123
+ callback = function(block) {
124
+ lBlocks.push(block);
125
+ };
126
+ filepath = "c:/Users/johnd/coffee-utils/test/data/file3.txt";
127
+ await forEachBlock(filepath, callback);
128
+ return simple.equal(76, lBlocks, ["abc\ndef", "abc\ndef\nghi", "abc\ndef\nghi\njkl"]);
129
+ })();
File without changes
@@ -0,0 +1,64 @@
1
+ // Generated by CoffeeScript 2.6.1
2
+ // block2.test.coffee
3
+ var filepath, simple, testDir;
4
+
5
+ import assert from 'assert';
6
+
7
+ import test from 'ava';
8
+
9
+ import {
10
+ undef,
11
+ say,
12
+ isString,
13
+ isHash,
14
+ isEmpty,
15
+ nonEmpty
16
+ } from '@jdeighan/coffee-utils';
17
+
18
+ import {
19
+ mydir,
20
+ mkpath
21
+ } from '@jdeighan/coffee-utils/fs';
22
+
23
+ import {
24
+ UnitTester
25
+ } from '@jdeighan/coffee-utils/test';
26
+
27
+ import {
28
+ forEachLine,
29
+ forEachBlock,
30
+ forEachSetOfBlocks
31
+ } from '@jdeighan/coffee-utils/block';
32
+
33
+ testDir = mydir(import.meta.url);
34
+
35
+ simple = new UnitTester();
36
+
37
+ filepath = mkpath(testDir, 'code2.test.txt');
38
+
39
+ // ----------------------------------------------------------------------------
40
+ (function() {
41
+ var callback, lFirstBlocks;
42
+ lFirstBlocks = undef;
43
+ callback = function(lBlocks) {
44
+ lFirstBlocks = lBlocks;
45
+ return true; // we're only interested in the first set
46
+ };
47
+ return test("line 29", async function(t) {
48
+ await forEachSetOfBlocks(filepath, callback);
49
+ return t.deepEqual(lFirstBlocks, ["f()", "f"]);
50
+ });
51
+ })();
52
+
53
+ // ----------------------------------------------------------------------------
54
+ (function() {
55
+ var callback, lAllBlockSets;
56
+ lAllBlockSets = [];
57
+ callback = function(lBlocks) {
58
+ lAllBlockSets.push(lBlocks);
59
+ };
60
+ return test("line 44", async function(t) {
61
+ await forEachSetOfBlocks(filepath, callback);
62
+ return t.deepEqual(lAllBlockSets, [["f()", "f"], ["f = (key=undef) ->\n\tswitch key\n\t\twhen 'ok'\n\t\t\tsay 'all is OK'", "f,say,mkpath"]]);
63
+ });
64
+ })();
@@ -250,8 +250,10 @@ tester = new TraceTester()
250
250
  simple.equal 250, lLines, [
251
251
  "enter myfunc"
252
252
  "└─> return from myfunc:"
253
- " 'this is one very long line'"
254
- " 'this is another very long line'"
253
+ " =========================================="
254
+ " this is one very long line"
255
+ " this is another very long line"
256
+ " =========================================="
255
257
  "Answer is 42"
256
258
  ]
257
259
  )()
@@ -0,0 +1,242 @@
1
+ // Generated by CoffeeScript 2.6.1
2
+ // debug.test.coffee
3
+ var TraceTester, lLines, simple, tester;
4
+
5
+ import {
6
+ undef,
7
+ OL
8
+ } from '@jdeighan/coffee-utils';
9
+
10
+ import {
11
+ blockToArray,
12
+ arrayToBlock
13
+ } from '@jdeighan/coffee-utils/block';
14
+
15
+ import {
16
+ log,
17
+ setLogger
18
+ } from '@jdeighan/coffee-utils/log';
19
+
20
+ import {
21
+ setDebugging,
22
+ debug,
23
+ resetDebugging,
24
+ funcMatch
25
+ } from '@jdeighan/coffee-utils/debug';
26
+
27
+ import {
28
+ UnitTester
29
+ } from '@jdeighan/coffee-utils/test';
30
+
31
+ simple = new UnitTester();
32
+
33
+ // ---------------------------------------------------------------------------
34
+ lLines = undef;
35
+
36
+ setLogger(function(str) {
37
+ return lLines.push(str);
38
+ });
39
+
40
+ setDebugging(true);
41
+
42
+ // ---------------------------------------------------------------------------
43
+ (function() {
44
+ lLines = [];
45
+ debug('abc');
46
+ return simple.equal(24, lLines, ['abc']);
47
+ })();
48
+
49
+ // ---------------------------------------------------------------------------
50
+ TraceTester = class TraceTester extends UnitTester {
51
+ initialize() {
52
+ return lLines = [];
53
+ }
54
+
55
+ transformValue(block) {
56
+ var i, len, line, ref;
57
+ ref = blockToArray(block);
58
+ for (i = 0, len = ref.length; i < len; i++) {
59
+ line = ref[i];
60
+ debug(line);
61
+ }
62
+ return arrayToBlock(lLines);
63
+ }
64
+
65
+ normalize(text) {
66
+ return text;
67
+ }
68
+
69
+ };
70
+
71
+ tester = new TraceTester();
72
+
73
+ // ---------------------------------------------------------------------------
74
+ (function() {
75
+ lLines = [];
76
+ debug('enter myfunc');
77
+ debug('something');
78
+ debug('more');
79
+ debug('return 42 from myfunc');
80
+ debug("Answer is 42");
81
+ return simple.equal(54, lLines, ["enter myfunc", "│ something", "│ more", "└─> return 42 from myfunc", "Answer is 42"]);
82
+ })();
83
+
84
+ // ---------------------------------------------------------------------------
85
+ (function() {
86
+ lLines = [];
87
+ debug('enter myfunc');
88
+ debug('something');
89
+ debug('enter newfunc');
90
+ debug('something else');
91
+ debug('return abc from newfunc');
92
+ debug('return 42 from myfunc');
93
+ return simple.equal(73, lLines, ["enter myfunc", "│ something", "│ enter newfunc", "│ │ something else", "│ └─> return abc from newfunc", "└─> return 42 from myfunc"]);
94
+ })();
95
+
96
+ // ---------------------------------------------------------------------------
97
+ (function() {
98
+ var obj;
99
+ lLines = [];
100
+ obj = {
101
+ first: 1,
102
+ second: 2
103
+ };
104
+ debug('enter myfunc');
105
+ debug('something');
106
+ debug('obj', obj);
107
+ debug('return 42 from myfunc');
108
+ return simple.equal(95, lLines, ["enter myfunc", "│ something", '│ obj = {"first":1,"second":2}', "└─> return 42 from myfunc"]);
109
+ })();
110
+
111
+ // ---------------------------------------------------------------------------
112
+ (function() {
113
+ var obj;
114
+ lLines = [];
115
+ obj = {
116
+ first: "this is the first item in the hash",
117
+ second: "this is the second item in the hash"
118
+ };
119
+ debug('enter myfunc');
120
+ debug('something');
121
+ debug('obj', obj);
122
+ debug('return 42 from myfunc');
123
+ return simple.equal(115, lLines, ["enter myfunc", "│ something", "│ obj:", "│ ---", "│ first: this is the first item in the hash", "│ second: this is the second item in the hash", "└─> return 42 from myfunc"]);
124
+ })();
125
+
126
+ // ---------------------------------------------------------------------------
127
+ // --- Test ability to debug only a particular function
128
+ (function() {
129
+ lLines = [];
130
+ resetDebugging();
131
+ setDebugging('innerFunc');
132
+ debug("enter myfunc");
133
+ debug("something");
134
+ debug("enter innerFunc");
135
+ debug("something else");
136
+ debug("return nothing from innerFunc");
137
+ debug("this should not appear");
138
+ debug("return 42 from myfunc");
139
+ simple.equal(141, lLines, ["enter innerFunc", "│ something else", "└─> return nothing from innerFunc"]);
140
+ return setDebugging(false);
141
+ })();
142
+
143
+ // ---------------------------------------------------------------------------
144
+ // --- Test ability to debug only a particular function
145
+ // using actual functions!
146
+ (function() {
147
+ var innerFunc, outerFunc;
148
+ lLines = [];
149
+ resetDebugging();
150
+ setDebugging('innerFunc');
151
+ innerFunc = function() {
152
+ var x;
153
+ debug("enter innerFunc()");
154
+ debug("answer is 42");
155
+ x = 42;
156
+ debug("return from innerFunc()");
157
+ };
158
+ outerFunc = function() {
159
+ debug("enter outerFunc()");
160
+ innerFunc();
161
+ debug("return from outerFunc()");
162
+ };
163
+ outerFunc();
164
+ simple.equal(175, lLines, ["enter innerFunc()", "│ answer is 42", "└─> return from innerFunc()"]);
165
+ return setDebugging(false);
166
+ })();
167
+
168
+ // ---------------------------------------------------------------------------
169
+ (function() {
170
+ setDebugging('get');
171
+ simple.truthy(188, funcMatch('get'));
172
+ simple.truthy(189, funcMatch('StringInput.get'));
173
+ return setDebugging(false);
174
+ })();
175
+
176
+ // ---------------------------------------------------------------------------
177
+ (function() {
178
+ var line;
179
+ resetDebugging();
180
+ setDebugging(true);
181
+ lLines = [];
182
+ line = 'first line';
183
+ debug(`line is ${OL(line)}`);
184
+ simple.equal(203, lLines.length, 1);
185
+ simple.equal(204, lLines, ["line is 'first line'"]);
186
+ return setDebugging(false);
187
+ })();
188
+
189
+ // ---------------------------------------------------------------------------
190
+ (function() {
191
+ var obj;
192
+ resetDebugging();
193
+ setDebugging(true);
194
+ lLines = [];
195
+ obj = {
196
+ first: "this is the first item in the hash",
197
+ second: "this is the second item in the hash"
198
+ };
199
+ debug('enter myfunc');
200
+ debug('return from myfunc', obj);
201
+ debug("Answer is 42");
202
+ return simple.equal(225, lLines, ["enter myfunc", "└─> return from myfunc:", " ---", " first: this is the first item in the hash", " second: this is the second item in the hash", "Answer is 42"]);
203
+ })();
204
+
205
+ // ---------------------------------------------------------------------------
206
+ (function() {
207
+ var longBlock;
208
+ resetDebugging();
209
+ setDebugging(true);
210
+ lLines = [];
211
+ longBlock = `this is one very long line
212
+ this is another very long line`;
213
+ debug('enter myfunc');
214
+ debug('return from myfunc', longBlock);
215
+ debug("Answer is 42");
216
+ return simple.equal(250, lLines, ["enter myfunc", "└─> return from myfunc:", " ==========================================", " this is one very long line", " this is another very long line", " ==========================================", "Answer is 42"]);
217
+ })();
218
+
219
+ // ---------------------------------------------------------------------------
220
+ (function() {
221
+ var block;
222
+ resetDebugging();
223
+ setDebugging('get');
224
+ block = `enter myfunc
225
+ enter get
226
+ enter fetch
227
+ return from fetch
228
+ return from get
229
+ enter nofunc
230
+ return from nofunc
231
+ enter get
232
+ something
233
+ return from get
234
+ return from myfunc`;
235
+ return tester.equal(279, block, `enter get
236
+ │ enter fetch
237
+ │ └─> return from fetch
238
+ └─> return from get
239
+ enter get
240
+ │ something
241
+ └─> return from get`);
242
+ })();
@@ -11,8 +11,9 @@ import {UnitTester} from '@jdeighan/coffee-utils/test'
11
11
  import {say, undef} from '@jdeighan/coffee-utils'
12
12
  import {debug} from '@jdeighan/coffee-utils/debug'
13
13
  import {
14
- mydir, mkpath, withExt, isFile, isDir, isSimpleFileName,
14
+ mydir, mkpath, isFile, isDir, isSimpleFileName,
15
15
  getSubDirs, pathTo, getFullPath, parseSource, fileExt,
16
+ withExt, withUnderScore,
16
17
  } from '@jdeighan/coffee-utils/fs'
17
18
 
18
19
  simple = new UnitTester()
@@ -22,7 +23,21 @@ assert existsSync(dir)
22
23
 
23
24
  # ---------------------------------------------------------------------------
24
25
 
25
- simple.equal 21, withExt('file.starbucks', 'svelte'), 'file.svelte'
26
+ hOpt = {removeLeadingUnderScore: true}
27
+
28
+ simple.equal 21, withExt('file.py', 'svelte'), 'file.svelte'
29
+ simple.equal 21, withExt('file.py', 'svelte', hOpt), 'file.svelte'
30
+ simple.equal 21, withExt('_file.py', 'svelte', hOpt), 'file.svelte'
31
+
32
+ simple.equal 21, withExt('/bin/file.py', 'svelte'), '/bin/file.svelte'
33
+ simple.equal 21, withExt('/bin/file.py', 'svelte', hOpt), '/bin/file.svelte'
34
+ simple.equal 21, withExt('/bin/_file.py', 'svelte', hOpt), '/bin/file.svelte'
35
+
36
+ simple.equal 21, withUnderScore('file.py', 'svelte'), '_file.py'
37
+ simple.equal 21, withUnderScore('_file.py', 'svelte'), '__file.py'
38
+
39
+ simple.equal 21, withUnderScore('/bin/file.py', 'svelte'), '/bin/_file.py'
40
+ simple.equal 21, withUnderScore('/bin/_file.py', 'svelte'), '/bin/__file.py'
26
41
 
27
42
  # ---------------------------------------------------------------------------
28
43
 
@@ -45,6 +60,7 @@ simple.equal 39, pathTo('test.txt', dir), \
45
60
  # ---------------------------------------------------------------------------
46
61
 
47
62
  simple.equal 44, mkpath('/usr/lib', 'johnd'), '/usr/lib/johnd'
63
+ simple.equal 48, mkpath('', '/usr/lib', undef, 'johnd'), '/usr/lib/johnd'
48
64
  simple.equal 45, mkpath("c:", 'local/user'), 'c:/local/user'
49
65
  simple.equal 46, mkpath('/usr', 'lib', 'local', 'johnd'),
50
66
  '/usr/lib/local/johnd'
@@ -0,0 +1,191 @@
1
+ // Generated by CoffeeScript 2.6.1
2
+ // fs.test.coffee
3
+ var dir, hOpt, myfname, mypath, rootdir, simple, wd;
4
+
5
+ import assert from 'assert';
6
+
7
+ import {
8
+ dirname,
9
+ resolve
10
+ } from 'path';
11
+
12
+ import {
13
+ fileURLToPath
14
+ } from 'url';
15
+
16
+ import {
17
+ existsSync,
18
+ copyFileSync,
19
+ readFileSync,
20
+ writeFileSync
21
+ } from 'fs';
22
+
23
+ import {
24
+ UnitTester
25
+ } from '@jdeighan/coffee-utils/test';
26
+
27
+ import {
28
+ say,
29
+ undef
30
+ } from '@jdeighan/coffee-utils';
31
+
32
+ import {
33
+ debug
34
+ } from '@jdeighan/coffee-utils/debug';
35
+
36
+ import {
37
+ mydir,
38
+ mkpath,
39
+ isFile,
40
+ isDir,
41
+ isSimpleFileName,
42
+ getSubDirs,
43
+ pathTo,
44
+ getFullPath,
45
+ parseSource,
46
+ fileExt,
47
+ withExt,
48
+ withUnderScore
49
+ } from '@jdeighan/coffee-utils/fs';
50
+
51
+ simple = new UnitTester();
52
+
53
+ dir = mydir(import.meta.url);
54
+
55
+ assert(existsSync(dir));
56
+
57
+ // ---------------------------------------------------------------------------
58
+ hOpt = {
59
+ removeLeadingUnderScore: true
60
+ };
61
+
62
+ simple.equal(21, withExt('file.py', 'svelte'), 'file.svelte');
63
+
64
+ simple.equal(21, withExt('file.py', 'svelte', hOpt), 'file.svelte');
65
+
66
+ simple.equal(21, withExt('_file.py', 'svelte', hOpt), 'file.svelte');
67
+
68
+ simple.equal(21, withExt('/bin/file.py', 'svelte'), '/bin/file.svelte');
69
+
70
+ simple.equal(21, withExt('/bin/file.py', 'svelte', hOpt), '/bin/file.svelte');
71
+
72
+ simple.equal(21, withExt('/bin/_file.py', 'svelte', hOpt), '/bin/file.svelte');
73
+
74
+ simple.equal(21, withUnderScore('file.py', 'svelte'), '_file.py');
75
+
76
+ simple.equal(21, withUnderScore('_file.py', 'svelte'), '__file.py');
77
+
78
+ simple.equal(21, withUnderScore('/bin/file.py', 'svelte'), '/bin/_file.py');
79
+
80
+ simple.equal(21, withUnderScore('/bin/_file.py', 'svelte'), '/bin/__file.py');
81
+
82
+ // ---------------------------------------------------------------------------
83
+ (function() {
84
+ var fname;
85
+ fname = 'debug.test.coffee';
86
+ simple.truthy(29, existsSync(`${dir}/${fname}`));
87
+ simple.falsy(30, existsSync(`${dir}/nosuchfile.test.coffee`));
88
+ return simple.equal(31, pathTo(`${fname}`, dir), `${dir}/${fname}`);
89
+ })();
90
+
91
+ // ---------------------------------------------------------------------------
92
+
93
+ // --- dirs are returned in alphabetical order
94
+ simple.equal(37, getSubDirs(dir), ['data', 'markdown', 'subdirectory']);
95
+
96
+ simple.equal(39, pathTo('test.txt', dir), `${dir}/subdirectory/test.txt`);
97
+
98
+ // ---------------------------------------------------------------------------
99
+ simple.equal(44, mkpath('/usr/lib', 'johnd'), '/usr/lib/johnd');
100
+
101
+ simple.equal(48, mkpath('', '/usr/lib', undef, 'johnd'), '/usr/lib/johnd');
102
+
103
+ simple.equal(45, mkpath("c:", 'local/user'), 'c:/local/user');
104
+
105
+ simple.equal(46, mkpath('/usr', 'lib', 'local', 'johnd'), '/usr/lib/local/johnd');
106
+
107
+ simple.equal(48, mkpath('\\usr\\lib', 'johnd'), '/usr/lib/johnd');
108
+
109
+ simple.equal(49, mkpath("c:", 'local\\user'), 'c:/local/user');
110
+
111
+ simple.equal(50, mkpath('\\usr', 'lib', 'local', 'johnd'), '/usr/lib/local/johnd');
112
+
113
+ simple.equal(55, mkpath('C:\\Users\\johnd', 'cielo'), 'c:/Users/johnd/cielo');
114
+
115
+ // ---------------------------------------------------------------------------
116
+ // test getFullPath()
117
+
118
+ // --- current working directory is the root dir, i.e. parent of this directory
119
+ wd = mkpath(process.cwd());
120
+
121
+ myfname = 'fs.test.coffee';
122
+
123
+ mypath = mkpath(dir, myfname);
124
+
125
+ rootdir = mkpath(resolve(dir, '..'));
126
+
127
+ assert(rootdir === wd, `${rootdir} should equal ${wd}`);
128
+
129
+ debug(`Current Working Directory = '${wd}'`);
130
+
131
+ debug(`dir = '${dir}'`);
132
+
133
+ debug(`myfname = '${myfname}'`);
134
+
135
+ debug(`mypath = '${mypath}'`);
136
+
137
+ debug(`rootdir = '${rootdir}'`);
138
+
139
+ // --- given a full path, only change \ to /
140
+ simple.equal(72, getFullPath(mypath), mypath);
141
+
142
+ // --- given a simple file name, prepend the current working directory
143
+ simple.equal(75, getFullPath(myfname), mkpath(rootdir, myfname));
144
+
145
+ // --- leading . should be resolved
146
+ simple.equal(78, getFullPath(`./${myfname}`), mkpath(rootdir, myfname));
147
+
148
+ // --- leading .. should be resolved
149
+ simple.equal(81, getFullPath(`./test/../${myfname}`), mkpath(rootdir, myfname));
150
+
151
+ simple.equal(86, parseSource('unit test'), {
152
+ filename: 'unit test',
153
+ stub: 'unit test'
154
+ });
155
+
156
+ simple.equal(91, parseSource("c:/Users/johnd/oz/src/test.js"), {
157
+ dir: 'c:/Users/johnd/oz/src',
158
+ fullpath: 'c:/Users/johnd/oz/src/test.js',
159
+ filename: 'test.js',
160
+ stub: 'test',
161
+ ext: '.js'
162
+ });
163
+
164
+ simple.equal(91, parseSource("c:\\Users\\johnd\\oz\\src\\test.js"), {
165
+ dir: 'c:/Users/johnd/oz/src',
166
+ fullpath: 'c:/Users/johnd/oz/src/test.js',
167
+ filename: 'test.js',
168
+ stub: 'test',
169
+ ext: '.js'
170
+ });
171
+
172
+ if (process.platform === 'win32') {
173
+ simple.truthy(108, isDir('c:/Users'));
174
+ simple.truthy(109, isDir('c:/Program Files'));
175
+ simple.falsy(110, isFile('c:/Users'));
176
+ simple.falsy(111, isFile('c:/Program Files'));
177
+ simple.falsy(113, isDir('c:/Windows/notepad.exe'));
178
+ simple.falsy(114, isDir('c:/Program Files/Windows Media Player/wmplayer.exe'));
179
+ simple.truthy(115, isFile('c:/Windows/notepad.exe'));
180
+ simple.truthy(116, isFile('c:/Program Files/Windows Media Player/wmplayer.exe'));
181
+ simple.truthy(118, isSimpleFileName('notepad.exe'));
182
+ simple.falsy(119, isSimpleFileName('c:/Program Files/Windows Media Player/wmplayer.exe'));
183
+ }
184
+
185
+ simple.equal(121, fileExt('file.txt'), '.txt');
186
+
187
+ simple.equal(122, fileExt('file.'), '');
188
+
189
+ simple.equal(123, fileExt('file.99'), '.99');
190
+
191
+ simple.equal(124, fileExt('file._txt'), '._txt');
File without changes