#######################################################
#
# Test getindices(), size 5
#
#######################################################

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

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

bundle agent init
{
  vars:
      "dummy" string => "dummy";

  files:
      "$(G.testfile).expected"
      create => "true",
      edit_line => init_insert;
}

bundle edit_line init_insert
{
  insert_lines:
      "alpha";
      "beta";
      "gamma's";
      "delta-delta:delta";
      "last";
}

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

bundle agent test
{
  vars:
      "array[alpha]" string => "zero";
      "array[beta]" string => "two";
      "array[gamma's]" string => "three's";
      "array[delta-delta:delta]" string => "four-fore:quatre";
      "array[last]" string => "last";

      "keys" slist => getindices("array");

  files:
      "$(G.testfile).actual"
      create => "true",
      edit_line => test_insert;

  reports:
    DEBUG::
      "Inserting line: $(keys)";
}

bundle edit_line test_insert
{
  vars:
      "keys" slist => { @{test.keys} };

  insert_lines:
      "$(keys)";
}

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

bundle agent check
{
  methods:
      "any" usebundle => sorted_check_diff("$(G.testfile).actual",
                                           "$(G.testfile).expected",
                                           "$(this.promise_filename)");
}
