#######################################################
#
# Iteration on slist of size 1
#
#######################################################
body common control
{
  inputs => { "../../default.sub.cf" };
  bundlesequence => { default("$(this.promise_filename)") };
  version => "1.0";
}

#######################################################
bundle agent init
{
  vars:
    "states" slist => { "actual", "expected" };
    "actual" string => "";
    "expected" string => "";

  files:
    "$(G.testfile).$(states)"
      create => "true",
      edit_line => init_insert("$(init.$(states))"),
      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
{
  files:
    "$(G.testfile).actual" edit_line => test_insert;
}

bundle edit_line test_insert
{
  vars:
    "one" slist => {};

  insert_lines:
    "$(one)";
}

#######################################################
bundle agent check
{
  methods:
    "any"
      usebundle => dcs_sort(
        "$(G.testfile).actual", "$(G.testfile).actual.sorted"
      );

    "any"
      usebundle => dcs_sort(
        "$(G.testfile).expected", "$(G.testfile).expected.sorted"
      );

    "any"
      usebundle => dcs_check_diff(
        "$(G.testfile).actual.sorted",
        "$(G.testfile).expected.sorted",
        "$(this.promise_filename)"
      );
}

body contain check_in_shell
{
  useshell => "true";
}
