~ps-jenkins/ubuntu-push/ubuntu-vivid-proposed

« back to all changes in this revision

Viewing changes to docs/example-server/node_modules/mocha/node_modules/glob/test/root.js

  • Committer: Roberto Alsina
  • Date: 2014-09-05 14:57:17 UTC
  • mto: (91.179.25 automatic)
  • mto: This revision was merged to the branch mainline in revision 129.
  • Revision ID: roberto.alsina@canonical.com-20140905145717-0ufcsv27w25i1nnu
added example app server

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
var t = require("tap")
 
2
 
 
3
var origCwd = process.cwd()
 
4
process.chdir(__dirname)
 
5
 
 
6
var glob = require('../')
 
7
var path = require('path')
 
8
 
 
9
t.test('.', function (t) {
 
10
  glob('/b*/**', { globDebug: true, root: '.' }, function (er, matches) {
 
11
    t.ifError(er)
 
12
    t.like(matches, [])
 
13
    t.end()
 
14
  })
 
15
})
 
16
 
 
17
 
 
18
t.test('a', function (t) {
 
19
  console.error("root=" + path.resolve('a'))
 
20
  glob('/b*/**', { globDebug: true, root: path.resolve('a') }, function (er, matches) {
 
21
    t.ifError(er)
 
22
    var wanted = [
 
23
        '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f'
 
24
      ].map(function (m) {
 
25
        return path.join(path.resolve('a'), m).replace(/\\/g, '/')
 
26
      })
 
27
 
 
28
    t.like(matches, wanted)
 
29
    t.end()
 
30
  })
 
31
})
 
32
 
 
33
t.test('root=a, cwd=a/b', function (t) {
 
34
  glob('/b*/**', { globDebug: true, root: 'a', cwd: path.resolve('a/b') }, function (er, matches) {
 
35
    t.ifError(er)
 
36
    t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ].map(function (m) {
 
37
      return path.join(path.resolve('a'), m).replace(/\\/g, '/')
 
38
    }))
 
39
    t.end()
 
40
  })
 
41
})
 
42
 
 
43
t.test('cd -', function (t) {
 
44
  process.chdir(origCwd)
 
45
  t.end()
 
46
})