Imported Upstream version 1.7.0
[platform/upstream/augeas.git] / lenses / tests / test_yaml.aug
1 module Test_YAML =
2
3 (* Inherit test *)
4 test YAML.lns get "host1:
5   <<: *production\n" =
6 { "host1"
7   { "<<" = "production" }
8 }
9
10 test YAML.lns get "
11 defaults: &defaults
12   repo1: master
13   repo2: master
14
15 # Live
16 production: &production
17   # repo3: dc89d7a
18   repo4:   2d39995
19   # repo5: bc4a40d
20
21 host1:
22   <<: *production
23
24 host2:
25   <<: *defaults
26   repo6: branch1
27
28 host3:
29   <<: *defaults
30   # repo7: branch2
31   repo8:   branch3
32 " =
33 {}
34 { "defaults" = "defaults"
35   { "repo1" = "master" }
36   { "repo2" = "master" }
37 }
38 {}
39 { "#comment" = "Live" }
40 { "production" = "production"
41   { "#comment" = "repo3: dc89d7a" }
42   { "repo4" = "2d39995" }
43   { "#comment" = "repo5: bc4a40d" }
44 }
45 {}
46 { "host1"
47   { "<<" = "production" }
48 }
49 {}
50 { "host2"
51   { "<<" = "defaults" }
52   { "repo6" = "branch1" }
53 }
54 {}
55 { "host3"
56   { "<<" = "defaults" }
57   { "#comment" = "repo7: branch2" }
58   { "repo8" = "branch3" }
59 }
60
61 (* Ruby YAML header *)
62 test YAML.lns get "--- !ruby/object:Puppet::Node::Factspress RETURN)\n" =
63   { "@yaml" = "!ruby/object:Puppet::Node::Factspress RETURN)" }
64
65
66 (* Continued lines *)
67 test YAML.lns get "abc:
68   def: |-
69   ghi
70 \n" =
71   { "abc"
72     { "def"
73       { "@mval"
74         { "@line" = "ghi" } } } }
75