Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dirs.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. var test = require('tape');
  2. var commondir = require('../');
  3. test('common', function (t) {
  4. t.equal(
  5. commondir([ '/foo', '//foo/bar', '/foo//bar/baz' ]),
  6. '/foo'
  7. );
  8. t.equal(
  9. commondir([ '/a/b/c', '/a/b', '/a/b/c/d/e' ]),
  10. '/a/b'
  11. );
  12. t.equal(
  13. commondir([ '/x/y/z/w', '/xy/z', '/x/y/z' ]),
  14. '/'
  15. );
  16. t.equal(
  17. commondir([ 'X:\\foo', 'X:\\\\foo\\bar', 'X://foo/bar/baz' ]),
  18. 'X:/foo'
  19. );
  20. t.equal(
  21. commondir([ 'X:\\a\\b\\c', 'X:\\a\\b', 'X:\\a\\b\\c\\d\\e' ]),
  22. 'X:/a/b'
  23. );
  24. t.equal(
  25. commondir([ 'X:\\x\\y\\z\\w', '\\\\xy\\z', '\\x\\y\\z' ]),
  26. '/'
  27. );
  28. t.throws(function () {
  29. commondir([ '/x/y/z/w', 'qrs', '/x/y/z' ]);
  30. });
  31. t.end();
  32. });
  33. test('base', function (t) {
  34. t.equal(
  35. commondir('/foo/bar', [ 'baz', './quux', '../bar/bazzy' ]),
  36. '/foo/bar'
  37. );
  38. t.equal(
  39. commondir('/a/b', [ 'c', '../b/.', '../../a/b/e' ]),
  40. '/a/b'
  41. );
  42. t.equal(
  43. commondir('/a/b/c', [ '..', '../d', '../../a/z/e' ]),
  44. '/a'
  45. );
  46. t.equal(
  47. commondir('/foo/bar', [ 'baz', '.\\quux', '..\\bar\\bazzy' ]),
  48. '/foo/bar'
  49. );
  50. // Tests including X:\ basedirs must wait until path.resolve supports
  51. // Windows-style paths, starting in Node.js v0.5.X
  52. t.end();
  53. });