1# Test that empty file is successfully read by readfile() function 2 3body common control 4{ 5 inputs => { "../../default.cf.sub" }; 6 bundlesequence => { default("$(this.promise_filename)") }; 7 version => "1.0"; 8} 9 10bundle agent init 11{ 12 files: 13 "$(G.testfile)" 14 create => "true"; 15} 16 17bundle agent test 18{ 19 vars: 20 "value1" string => readfile("$(G.testfile)", 10000); 21 "value2" string => readfile("$(G.testfile)", 0); 22} 23 24bundle agent check 25{ 26 classes: 27 "ok1" expression => strcmp("$(test.value1)", ""); 28 "ok2" expression => strcmp("$(test.value2)", ""); 29 "not_ok1" not => strcmp("$(test.value1)", ""); 30 "not_ok2" not => strcmp("$(test.value2)", ""); 31 "ok" and => { "ok1", "ok2" }; 32 33 reports: 34 DEBUG.ok1:: 35 "passed1: '$(test.value1)' == ''"; 36 DEBUG.ok2:: 37 "passed2: '$(test.value1)' == ''"; 38 DEBUG.not_ok1:: 39 "failed1: '$(test.value1)' != ''"; 40 DEBUG.not_ok2:: 41 "failed2: '$(test.value2)' != ''"; 42 43 ok:: 44 "$(this.promise_filename) Pass"; 45 !ok:: 46 "$(this.promise_filename) FAIL"; 47} 48