#######################################################
#
# Test setting associative array in module (Issue 714)
#
#######################################################

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


bundle agent init
{
  vars:
      "script_name" string => "$(this.promise_filename).txt";
}

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

bundle agent test
{
  vars:
    !windows::
      "cat_prefix" string => "cat";
    windows::
      "cat_prefix" string => "cat_exe";

  commands:
      "$(G.cat) $(init.script_name)"
        contain => in_shell,
        module => "true";
}

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

bundle agent check
{
  vars:
      "generated_indices" slist => getindices("$(test.cat_prefix).answer");

  classes:

      "ok" and => { strcmp("${$(test.cat_prefix).answer[42]}", "Yes"),
                    strcmp("${$(test.cat_prefix).answer[41]}", "No") };

  reports:
    DEBUG::
      "${$(test.cat_prefix).answer[${generated_indices}]}";
    ok::
      "$(this.promise_filename) Pass";
    !ok::
      "$(this.promise_filename) FAIL";
}

### PROJECT_ID: core
### CATEGORY_ID: 26
