~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/unistd/io.js

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(function() {
 
2
  var devicePayload = [65, 66, 67, 68];
 
3
  FS.createDevice('/', 'device', function() {
 
4
    if (devicePayload.length) {
 
5
      return devicePayload.shift();
 
6
    } else {
 
7
      return null;
 
8
    }
 
9
  }, function(arg) {
 
10
    Module.print("TO DEVICE: " + arg);
 
11
  });
 
12
  FS.createDevice('/', 'broken-device', function() {
 
13
    throw new Error('Broken device input.');
 
14
  }, function(arg) {
 
15
    throw new Error('Broken device output.');
 
16
  });
 
17
  FS.createDataFile('/', 'file', '1234567890', true, true);
 
18
  FS.createFolder('/', 'folder', true, true);
 
19
})();