# Test that function call with computed if does not lead to incorrect
# use of values (Mantis #864) (Mantis #1084)

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

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

bundle agent test
{
  vars:
      "subout" string => execresult("$(sys.cf_agent) -Kf $(this.promise_filename).sub", "useshell");
}

bundle agent check
{
  classes:
      "ok" not => regcmp(".*Unable to parse class expression.*", "$(test.subout)");

  reports:
    DEBUG::
      "$(test.subout)";
    ok::
      "$(this.promise_filename) Pass";
    !ok::
      "$(this.promise_filename) FAIL";
}
