aboutsummaryrefslogtreecommitdiff
path: root/tests/rep-add.test
blob: a1b910432e14be6be2a1fc9f191b9e4ad9e65db1 (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
# file      : tests/rep-add.test
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license   : MIT; see accompanying LICENSE file

.include common.test config.test

: location
:
{
  : none
  :
  $* 2>>EOE != 0
  error: repository location argument expected
    info: run 'bpkg help rep-add' for more information
  EOE

  : no-version
  :
  $* 'stable' 2>>EOE != 0
  error: invalid repository location 'stable': missing repository version
  EOE

  : invalid-host
  :
  $* 'http://' 2>>EOE != 0
  error: invalid repository location 'http://': invalid host
  EOE
}

: relative-path
:
{
  $clone_cfg;

  $* ./1/bar/stable 2>>/~%EOE%;
    %added repository .+/relative-path/bar/stable%
    EOE

  $* ./1/../1/bar/stable 2>>/~%EOE% != 0
    %error: .+/relative-path/bar/stable is already a repository of this configuration%
    EOE
}

: absolute-path
:
{
  $clone_cfg;

  $* $~/1/foo/stable 2>>/~%EOE%;
    %added repository .+/absolute-path/foo/stable%
    EOE

  $* $~/1/../1/foo/stable 2>>/~%EOE% != 0
    %error: .+/absolute-path/foo/stable is already a repository of this configuration%
    EOE
}

: remote-url
:
{
  $clone_cfg;

  $* 'http://pkg.example.org/1/testing' 2>>~%EOE%;
    %added repository example.org/testing%
    EOE

  $* 'https://www.example.org/1/testing' 2>>~%EOE% != 0
    %error: example.org/testing is already a repository of this configuration%
    EOE
}