From: Cheng Zhao Date: Mon, 29 Sep 2014 08:05:19 +0000 (+0800) Subject: spec: asar: fs.open X-Git-Tag: v0.17.0~6^2~12 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=e3ae062c5c173046572a0e7506312516fe5589a5;p=electron.git spec: asar: fs.open --- diff --git a/spec/asar-spec.coffee b/spec/asar-spec.coffee index 996924a1..f129c0d8 100644 --- a/spec/asar-spec.coffee +++ b/spec/asar-spec.coffee @@ -214,3 +214,18 @@ describe 'asar package', -> stats = fs.readdir p, (err, stats) -> assert.equal err.code, 'ENOENT' done() + + describe 'fs.openSync', -> + it 'opens a normal/linked/under-linked-directory file', -> + for file in ['file1', 'link1', path.join('link2', 'file1')] + p = path.join fixtures, 'asar', 'a.asar', file + fd = fs.openSync p, 'r' + buffer = new Buffer(6) + fs.readSync fd, buffer, 0, 6, 0 + assert.equal String(buffer), 'file1\n' + fs.closeSync fd + + it 'throws ENOENT error when can not find file', -> + p = path.join fixtures, 'asar', 'a.asar', 'not-exist' + throws = -> fs.openSync p + assert.throws throws, /ENOENT/