Welcome to mirror list, hosted at ThFree Co, Russian Federation.

windows.js « test « npm-package-arg « node_modules « npm « deps - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b91416e2f96e52c5b935e067a8546ce9db0762a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
global.FAKE_WINDOWS = true

var npa = require("../npa.js")
var test = require("tap").test
var path = require("path")

var cases = {
  "C:\\x\\y\\z": {
    raw: "C:\\x\\y\\z",
    scope: null,
    name: null,
    rawSpec: "C:\\x\\y\\z",
    spec: "C:\\x\\y\\z",
    type: "local"
  },
  "foo@C:\\x\\y\\z": {
    raw: "foo@C:\\x\\y\\z",
    scope: null,
    name: "foo",
    rawSpec: "C:\\x\\y\\z",
    spec: "C:\\x\\y\\z",
    type: "local"
  },
  "foo@file:///C:\\x\\y\\z": {
    raw: "foo@file:///C:\\x\\y\\z",
    scope: null,
    name: "foo",
    rawSpec: "file:///C:\\x\\y\\z",
    spec: "C:\\x\\y\\z",
    type: "local"
  },
  "foo@file://C:\\x\\y\\z": {
    raw: "foo@file://C:\\x\\y\\z",
    scope: null,
    name: "foo",
    rawSpec: "file://C:\\x\\y\\z",
    spec: "C:\\x\\y\\z",
    type: "local"
  },
  "file:///C:\\x\\y\\z": {
    raw: "file:///C:\\x\\y\\z",
    scope: null,
    name: null,
    rawSpec: "file:///C:\\x\\y\\z",
    spec: "C:\\x\\y\\z",
    type: "local"
  },
  "file://C:\\x\\y\\z": {
    raw: "file://C:\\x\\y\\z",
    scope: null,
    name: null,
    rawSpec: "file://C:\\x\\y\\z",
    spec: "C:\\x\\y\\z",
    type: "local"
  },
  "foo@/foo/bar/baz": {
    raw: "foo@/foo/bar/baz",
    scope: null,
    name: "foo",
    rawSpec: "/foo/bar/baz",
    spec: "/foo/bar/baz",
    type: "local"
  }
}

test("parse a windows path", function (t) {
  Object.keys(cases).forEach(function (c) {
    var expect = cases[c]
    var actual = npa(c)
    t.same(actual, expect, c)
  })
  t.end()
})