#
# Test escape() - issue 689
#

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

bundle common g
{
  vars:
      "dummy" string => "dummy";
}

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

bundle agent test
{
  vars:
      "t1" string => escape("1,2");
      "e1" string => "1,2";
      "t2" string => escape("{1,2}");
      "e2" string => "{1,2}";
}

bundle agent check
{
  classes:
      "ok1" expression => regcmp("$(test.t1)", "$(test.e1)");
      "ok2" expression => regcmp("$(test.t2)", "$(test.e2)");
      "ok" and => { "ok1", "ok2" };

  reports:
    DEBUG::
      "Comparing actual vs. expected:";
    DEBUG.ok1::
      "'$(test.t1)' is the same as '$(test.e1)'";
    DEBUG.!ok1::
      "'$(test.t1)' is NOT the same as '$(test.e1)'";
    DEBUG.ok2::
      "'$(test.t2)' is the same as '$(test.e2)'";
    DEBUG.!ok2::
      "'$(test.t2)' is NOT the same as '$(test.e2)'";
    ok::
      "$(this.promise_filename) Pass";

    !ok::
      "$(this.promise_filename) FAIL";
}
