Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / tests / test_puppetfile.aug
1 (*
2 Module: Test_Puppetfile
3   Provides unit tests and examples for the <Puppetfile> lens.
4 *)
5 module Test_Puppetfile =
6
7 (* Test: Puppetfile.lns *)
8 test Puppetfile.lns get "forge \"https://forgeapi.puppetlabs.com\" # the default forge
9
10 mod 'puppetlabs-razor'
11 mod 'puppetlabs-ntp', \"0.0.3\"
12
13 mod 'puppetlabs-apt',
14   :git => \"git://github.com/puppetlabs/puppetlabs-apt.git\"
15
16 mod 'puppetlabs-stdlib',
17   :git => \"git://github.com/puppetlabs/puppetlabs-stdlib.git\"
18
19 mod 'puppetlabs-apache', '0.6.0',
20   :github_tarball => 'puppetlabs/puppetlabs-apache'
21
22 metadata # we want metadata\n" =
23   { "forge" = "https://forgeapi.puppetlabs.com"
24     { "#comment" = "the default forge" } }
25   {  }
26   { "1" = "puppetlabs-razor" }
27   { "2" = "puppetlabs-ntp"
28     { "@version" = "0.0.3" }
29   }
30   {  }
31   { "3" = "puppetlabs-apt"
32     { "git" = "git://github.com/puppetlabs/puppetlabs-apt.git" }
33   }
34   {  }
35   { "4" = "puppetlabs-stdlib"
36     { "git" = "git://github.com/puppetlabs/puppetlabs-stdlib.git" }
37   }
38   {  }
39   { "5" = "puppetlabs-apache"
40     { "@version" = "0.6.0" }
41     { "github_tarball" = "puppetlabs/puppetlabs-apache" }
42   }
43   {  }
44   { "metadata" { "#comment" = "we want metadata" } }
45
46 (* Test: Puppetfile.lns
47      Complex version conditions *)
48 test Puppetfile.lns get "mod 'puppetlabs/stdlib',        '< 5.0.0'
49 mod 'theforeman/concat_native', '>= 1.3.0 < 1.4.0'
50 mod 'herculesteam/augeasproviders', '2.1.x'\n" =
51   { "1" = "puppetlabs/stdlib"
52     { "@version" = "< 5.0.0" }
53   }
54   { "2" = "theforeman/concat_native"
55     { "@version" = ">= 1.3.0 < 1.4.0" }
56   }
57   { "3" = "herculesteam/augeasproviders"
58     { "@version" = "2.1.x" }
59   }
60
61 (* Test: Puppetfile.lns
62      Owner is not mandatory if git is given *)
63 test Puppetfile.lns get "mod 'stdlib',
64   :git => \"git://github.com/puppetlabs/puppetlabs-stdlib.git\"\n" =
65   { "1" = "stdlib"
66     { "git" = "git://github.com/puppetlabs/puppetlabs-stdlib.git" } }
67
68
69 (* Issue #427 *)
70 test Puppetfile.lns get "mod 'puppetlabs/apache', :latest\n" =
71   { "1" = "puppetlabs/apache"
72     { "latest" } }
73
74 test Puppetfile.lns get "mod 'data',
75   :git    => 'ssh://git@stash.example.com/bp/puppet-hiera.git',
76   :branch => :control_branch,
77   :default_branch => 'development',
78   :install_path   => '.'\n" =
79   { "1" = "data"
80     { "git" = "ssh://git@stash.example.com/bp/puppet-hiera.git" }
81     { "branch" = ":control_branch" }
82     { "default_branch" = "development" }
83     { "install_path" = "." } }
84
85 (* Comment: after module name comma
86     This conflicts with the comma comment tree below *)
87 test Puppetfile.lns get "mod 'data' # eol comment\n" = *
88
89 (* Comment: after first comma *)
90 test Puppetfile.lns get "mod 'data', # eol comment
91   # and another
92   '1.2.3'\n" =
93   { "1" = "data"
94     { "#comment" = "eol comment" }
95     { "#comment" = "and another" }
96     { "@version" = "1.2.3" } }
97
98 (* Comment: after version
99     Current culprit: need two \n *)
100 test Puppetfile.lns get "mod 'data', '1.2.3' # eol comment\n" = *
101 test Puppetfile.lns get "mod 'data', '1.2.3' # eol comment\n\n" =
102   { "1" = "data"
103     { "@version" = "1.2.3" { "#comment" = "eol comment" } } }
104
105 (* Comment: eol after version comma *)
106 test Puppetfile.lns get "mod 'data', '1.2.3', # a comment
107     :local => true\n" =
108   { "1" = "data"
109     { "@version" = "1.2.3" }
110     { "#comment" = "a comment" }
111     { "local" = "true" } }
112
113 (* Comment: after version comma with newline *)
114 test Puppetfile.lns get "mod 'data', '1.2.3',
115  # a comment
116     :local => true\n" =
117   { "1" = "data"
118     { "@version" = "1.2.3" }
119     { "#comment" = "a comment" }
120     { "local" = "true" } }
121
122 (* Comment: eol before opts, without version *)
123 test Puppetfile.lns get "mod 'data', # a comment
124     # :ref => 'abcdef',
125     :local => true\n" =
126   { "1" = "data"
127     { "#comment" = "a comment" }
128     { "#comment" = ":ref => 'abcdef'," }
129     { "local" = "true" } }
130
131 (* Comment: after opt comma *)
132 test Puppetfile.lns get "mod 'data', '1.2.3',
133     :ref => 'abcdef', # eol comment
134     :local => true\n" =
135   { "1" = "data"
136     { "@version" = "1.2.3" }
137     { "ref" = "abcdef" }
138     { "#comment" = "eol comment" }
139     { "local" = "true" } }
140
141 (* Comment: in opts *)
142 test Puppetfile.lns get "mod 'data', '1.2.3',
143     :ref => 'abcdef',
144     # a comment
145     :local => true\n" =
146   { "1" = "data"
147     { "@version" = "1.2.3" }
148     { "ref" = "abcdef" }
149     { "#comment" = "a comment" }
150     { "local" = "true" } }
151
152 (* Comment: after last opt *)
153 test Puppetfile.lns get "mod 'data', '1.2.3',
154     :local => true # eol comment\n\n" =
155   { "1" = "data"
156     { "@version" = "1.2.3" }
157     { "local" = "true" }
158     { "#comment" = "eol comment" } }