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

« back to all changes in this revision

Viewing changes to tests/filesystem/src.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
FS.createFolder('/', 'forbidden', false, false);
 
2
FS.createFolder('/forbidden', 'test', true, true);
 
3
FS.createPath('/', 'abc/123', true, true);
 
4
FS.createPath('/', 'abc/456', true, true);
 
5
FS.createPath('/', 'def/789', true, true);
 
6
FS.createDevice('/abc', 'deviceA', function() {}, function() {});
 
7
FS.createDevice('/def', 'deviceB', function() {}, function() {});
 
8
FS.createLink('/abc', 'localLink', '123', true, true);
 
9
FS.createLink('/abc', 'rootLink', '/', true, true);
 
10
FS.createLink('/abc', 'relativeLink', '../def', true, true);
 
11
 
 
12
function explore(path) {
 
13
  Module.print(path);
 
14
  var ret = FS.analyzePath(path);
 
15
  Module.print('  isRoot: ' + ret.isRoot);
 
16
  Module.print('  exists: ' + ret.exists);
 
17
  Module.print('  error: ' + ret.error);
 
18
  Module.print('  path: ' + ret.path);
 
19
  Module.print('  name: ' + ret.name);
 
20
  Module.print('  object.contents: ' + (ret.object && JSON.stringify(Object.keys(ret.object.contents || {}))));
 
21
  Module.print('  parentExists: ' + ret.parentExists);
 
22
  Module.print('  parentPath: ' + ret.parentPath);
 
23
  Module.print('  parentObject.contents: ' + (ret.parentObject && JSON.stringify(Object.keys(ret.parentObject.contents))));
 
24
  Module.print('');
 
25
}
 
26
 
 
27
FS.currentPath = '/abc';
 
28
explore('');
 
29
explore('/');
 
30
explore('.');
 
31
explore('..');
 
32
explore('../..');
 
33
explore('/abc');
 
34
explore('/abc/123');
 
35
explore('/abc/noexist');
 
36
explore('/abc/deviceA');
 
37
explore('/abc/localLink');
 
38
explore('/abc/rootLink');
 
39
explore('/abc/relativeLink');
 
40
explore('/abc/relativeLink/deviceB');
 
41
explore('/abc/rootLink/noexist');
 
42
explore('/abc/rootLink/abc/noexist');
 
43
explore('/forbidden');
 
44
explore('/forbidden/test');
 
45
explore('/forbidden/noexist');
 
46
explore('/noexist1/noexist2');