~yolanda.robla/ubuntu/trusty/nodejs/add_distribution

« back to all changes in this revision

Viewing changes to test/simple/test-fs-write-file.js

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2013-08-14 00:16:46 UTC
  • mfrom: (7.1.40 sid)
  • Revision ID: package-import@ubuntu.com-20130814001646-bzlysfh8sd6mukbo
Tags: 0.10.15~dfsg1-4
* Update 2005 patch, adding a handful of tests that can fail on
  slow platforms.
* Add 1004 patch to fix test failures when writing NaN to buffer
  on mipsel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
var fs = require('fs');
25
25
var join = require('path').join;
26
26
 
27
 
var filename = join(common.fixturesDir, 'test.txt');
 
27
var filename = join(common.tmpDir, 'test.txt');
28
28
 
29
29
common.error('writing to ' + filename);
30
30
 
54
54
});
55
55
 
56
56
// test that writeFile accepts buffers
57
 
var filename2 = join(common.fixturesDir, 'test2.txt');
 
57
var filename2 = join(common.tmpDir, 'test2.txt');
58
58
var buf = new Buffer(s, 'utf8');
59
59
common.error('writing to ' + filename2);
60
60
 
73
73
});
74
74
 
75
75
// test that writeFile accepts numbers.
76
 
var filename3 = join(common.fixturesDir, 'test3.txt');
 
76
var filename3 = join(common.tmpDir, 'test3.txt');
77
77
common.error('writing to ' + filename3);
78
78
 
79
 
fs.writeFile(filename3, n, function(e) {
 
79
var m = 0600;
 
80
fs.writeFile(filename3, n, { mode: m }, function(e) {
80
81
  if (e) throw e;
81
82
 
 
83
  // windows permissions aren't unix
 
84
  if (process.platform !== 'win32') {
 
85
    var st = fs.statSync(filename3);
 
86
    assert.equal(st.mode & 0700, m);
 
87
  }
 
88
 
82
89
  ncallbacks++;
83
90
  common.error('file3 written');
84
91