#######################################################
#
# Test getvalues(string), should return the string itself
#
#######################################################
body common control
{
  inputs => { "../../default.sub.cf" };
  bundlesequence => { default("$(this.promise_filename)") };
  version => "1.0";
}

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

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

bundle edit_line init_insert(str)
{
  insert_lines:
    "$(str)";
}

body edit_defaults init_empty
{
  empty_file_before_editing => "true";
}

#######################################################
bundle agent test
{
  vars:
    "array" string => "blah"; # Intentionally not an array
    "vals" slist => getvalues("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)"
      );
}
