#######################################################
#
# Test maplist()
#
#######################################################

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

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

bundle agent test
{
  vars:
      "testlist" slist => { "zero", "two", "three's", "four-fore:quatre", "last" };
      "empty" slist => { };

      "mapped_testlist" slist => maplist("value=$(this)", "testlist");
      "mapped_empty" slist => maplist("value=$(this)", empty);
      "mapped_inline" slist => maplist("value=$(this)", '["a", "b", "c"]');
      "mapped_function_empty" slist => maplist(canonify($(this)), empty);
      "mapped_function1" slist => maplist(format("%10.10s", $(this)), testlist);
      "mapped_function2" slist => maplist(canonify($(this)), '["a or b", "b and c", "c+d", "e"]');
}

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

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