From 190abcac9debb2f4c729af32f88703d26026a049 Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 12 Sep 2011 17:10:24 -0700 Subject: [PATCH] mkdir EEXIST test Fixed on uv 3c00d87b4239a6b8358e2085f806170c3eca10cf --- test/simple/test-mkdir-rmdir.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/test/simple/test-mkdir-rmdir.js b/test/simple/test-mkdir-rmdir.js index dbafa8275a5..023d4d49766 100644 --- a/test/simple/test-mkdir-rmdir.js +++ b/test/simple/test-mkdir-rmdir.js @@ -35,14 +35,21 @@ fs.mkdir(d, 0666, function(err) { console.log('mkdir error: ' + err.message); mkdir_error = true; } else { - console.log('mkdir okay!'); - fs.rmdir(d, function(err) { - if (err) { - console.log('rmdir error: ' + err.message); - rmdir_error = true; - } else { - console.log('rmdir okay!'); - } + fs.mkdir(d, 0666, function(err) { + console.log('expect EEXIST error: ', err); + assert.ok(err.message.match(/^EEXIST/), 'got EEXIST message'); + assert.equal(err.code, 'EEXIST', 'got EEXIST code'); + assert.equal(err.path, d, 'got proper path for EEXIST'); + + console.log('mkdir okay!'); + fs.rmdir(d, function(err) { + if (err) { + console.log('rmdir error: ' + err.message); + rmdir_error = true; + } else { + console.log('rmdir okay!'); + } + }); }); } });