#######################################################
#
# Test grep(), size 2 local array
#
#######################################################

body common control
{
      inputs => { "../../default.cf.sub" };
      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:
      "Two";
      "Three";
}

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

bundle agent test
{
  vars:
      "array" slist => { "One", "Two", "Three", "Four", "Five" };

      "vals" slist => grep("T.*", "array");

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

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

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

  insert_lines:
      "$(vals)";
}

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

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

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

bundle agent fini
{
  methods:
      "any" usebundle => dcs_fini("$(G.testfile).*");
}
