mark.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. var test = require("tap").test
  2. var glob = require('../')
  3. process.chdir(__dirname)
  4. test("mark, no / on pattern", function (t) {
  5. glob("a/*", {mark: true}, function (er, results) {
  6. if (er)
  7. throw er
  8. var expect = [ 'a/abcdef/',
  9. 'a/abcfed/',
  10. 'a/b/',
  11. 'a/bc/',
  12. 'a/c/',
  13. 'a/cb/' ]
  14. if (process.platform !== "win32")
  15. expect.push('a/symlink/')
  16. t.same(results, expect)
  17. t.end()
  18. })
  19. })
  20. test("mark=false, no / on pattern", function (t) {
  21. glob("a/*", function (er, results) {
  22. if (er)
  23. throw er
  24. var expect = [ 'a/abcdef',
  25. 'a/abcfed',
  26. 'a/b',
  27. 'a/bc',
  28. 'a/c',
  29. 'a/cb' ]
  30. if (process.platform !== "win32")
  31. expect.push('a/symlink')
  32. t.same(results, expect)
  33. t.end()
  34. })
  35. })
  36. test("mark=true, / on pattern", function (t) {
  37. glob("a/*/", {mark: true}, function (er, results) {
  38. if (er)
  39. throw er
  40. var expect = [ 'a/abcdef/',
  41. 'a/abcfed/',
  42. 'a/b/',
  43. 'a/bc/',
  44. 'a/c/',
  45. 'a/cb/' ]
  46. if (process.platform !== "win32")
  47. expect.push('a/symlink/')
  48. t.same(results, expect)
  49. t.end()
  50. })
  51. })
  52. test("mark=false, / on pattern", function (t) {
  53. glob("a/*/", function (er, results) {
  54. if (er)
  55. throw er
  56. var expect = [ 'a/abcdef/',
  57. 'a/abcfed/',
  58. 'a/b/',
  59. 'a/bc/',
  60. 'a/c/',
  61. 'a/cb/' ]
  62. if (process.platform !== "win32")
  63. expect.push('a/symlink/')
  64. t.same(results, expect)
  65. t.end()
  66. })
  67. })