test: fix create-file test fixture
authorAlexis Campailla <alexis@janeasystems.com>
Tue, 10 Dec 2013 13:25:27 +0000 (05:25 -0800)
committerFedor Indutny <fedor.indutny@gmail.com>
Tue, 10 Dec 2013 16:09:07 +0000 (20:09 +0400)
This was failing if the file didn't already exist.

Fixes unit tests on Windows:

* test\simple\test-http-curl-chunk-problem.js
* test\simple\test-pipe-file-to-http.js

test/fixtures/create-file.js

index c711da6..f2d89f3 100644 (file)
@@ -24,4 +24,6 @@ var fs = require('fs');
 var file_name = process.argv[2];
 var file_size = parseInt(process.argv[3]);
 
-fs.truncateSync(file_name, file_size);
+var fd = fs.openSync(file_name, 'w');
+fs.ftruncateSync(fd, file_size);
+fs.closeSync(fd);