File: join.cf

package info (click to toggle)
cfengine3 3.24.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 37,552 kB
  • sloc: ansic: 163,161; sh: 10,296; python: 2,950; makefile: 1,744; lex: 784; yacc: 633; perl: 211; pascal: 157; xml: 21; sed: 13
file content (81 lines) | stat: -rw-r--r-- 2,716 bytes parent folder | download | duplicates (5)
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
74
75
76
77
78
79
80
81
#######################################################
#
# test join()
#
#######################################################

body common control
{
      inputs => { "../../default.cf.sub" };
      bundlesequence  => { default("$(this.promise_filename)") };
      version => "1.0";
}

#######################################################

bundle agent init
{
  vars:
      "a" slist => { "b", "c", "a" };
      "b" slist => { "100", "9", "10" };
      "c" slist => { };
      "d" slist => { "", "a", "", "b" };
      "e" slist => { "a", "1", "b" };
      "f" rlist => { "100", "200", "300" };
      "g" rlist => { "1.11", "-2.22", "-3.33" };
      "h" ilist => { "-10", "0", "200" };
      "i" data => parsejson('[ 1, 2, "", 3000, "" ]');
      "j" data => parsejson('[ 1, 2, [ 3, 4, 5 ], null, true, false ]');
      "k" data => parsejson('{}');
      "l" data => parsejson('{ "a": 100, "b": 200, "c": null}');
      "m" slist => { "cf_null" };
      "n" slist => { "a", "b", "c", "cf_null" };
      "o" slist => { @(a), @(c) };
      "p" slist => { @(c), @(m) };
      "q" slist => { ":", ":" };
      "r" slist => { ":", @(c) };
      "s" slist => { ":", @(c), @(m) };
      "t" slist => { @(n), @(m), @(n), ":" };

      "lists" slist => { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t" };
}

#######################################################

bundle agent test
{
      # "expected_a" string => "b:c:a";
      # "expected_b" string => "100:9:10";
      # "expected_c" string => "";
      # "expected_d" string => ":a::b";
      # "expected_e" string => "a:1:b";
      # "expected_f" string => "100:200:300";
      # "expected_g" string => "1.11:-2.22:-3.33";
      # "expected_h" string => "-10:0:200";
      # "expected_i" string => "1:2::3000:";
      # "expected_j" string => "1:2:true:false";
      # "expected_k" string => "";
      # "expected_l" string => "100:200";
      # "expected_m" string => "cf_null";
      # "expected_n" string => "a:b:c:cf_null";
      # "expected_o" string => "b:c:a";
      # "expected_p" string => "cf_null";
      # "expected_q" string => ":::";
      # "expected_r" string => ":";
      # "expected_s" string => "::cf_null";
      # "expected_t" string => "a:b:c:cf_null:cf_null:a:b:c:cf_null::";
  vars:
      "lists" slist => { @(init.lists) };
      "join_$(lists)" string => join(":", "init.$(lists)");
}


#######################################################

bundle agent check
{
  methods:
      "check"  usebundle => dcs_check_state(test,
                                           "$(this.promise_filename).expected.json",
                                           $(this.promise_filename));
}