Sha256: dc7f619f0613840a5bb1bb305a59845d614bd662a995bddf87243013d40b546a

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 KB

Contents

XULTestCase.create("File Test", function(setup, teardown, test) {

  test("File.join should properly put together strings", function() {
    this.assertEqual($CURRENT_FILE, File.join($CURRENT_DIRECTORY, "file_test.js"));
  });
  
  test("File.read without a maxBytes argument should read the entire contents of a file if it exists", function() {
    this.assertEqual("var love = true;", File.read(File.join($CURRENT_DIRECTORY, "fixtures", "love.js")));
  });  

  test("File.read with a maxBytes argument should read the given number of bytes from a file", function() {
    this.assertEqual("var love", File.read(File.join($CURRENT_DIRECTORY, "fixtures", "love.js"), 8));
  });
  
  test("File.read with a maxBytes argument of 0 shouldn't throw an exception", function() {
    this.assertEqual("", File.read(File.join($CURRENT_DIRECTORY, "fixtures", "love.js"), 0));
  });
  
  test("File.read with an empty file shouldn't throw an exception", function() {
    this.assertEqual("", File.read(File.join($CURRENT_DIRECTORY, "fixtures", "empty")));
  });
  
  test("File.read with a non-existent file should throw an exception", function() {
    this.assertRaise("File.NoSuchFileError", function(){ File.read("/tmp/ohmanihopethisfiledoesntexist"); });
  });
  
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
xpcomcore-rubygem-0.6.2 xpcomcore/test/file_test.js
xpcomcore-rubygem-0.6.0 xpcomcore/test/file_test.js
xpcomcore-rubygem-0.5.3 xpcomcore/test/file_test.js
xpcomcore-rubygem-0.5.2 xpcomcore/test/file_test.js
xpcomcore-rubygem-0.5.1 xpcomcore/test/file_test.js
xpcomcore-rubygem-0.5.0 xpcomcore/test/file_test.js
xpcomcore-rubygem-0.3.2 xpcomcore/test/file_test.js