// -*- js -*- def assert(x, msg) { if (!x) { print("ERROR: assert failed: " + msg); assert_failure(); // indirect throw } } var args = args_parser(); args.bool_opt("fail", "fail the program immediately", "false"); if(args.parse().fail) { exit(-42); } var b = buffer(); b.paste("hello this is some text"); b.set_mark(); b.rfind("some"); var t = b.copy(); assert(t + "." == "some text.", "concat text+string"); assert(".some text" == "." + t, "concat string+text"); assert(t + ".some text" == t + "." + t, "concat text+text"); assert((t == ".") == false, "eq compare should fail"); assert(("." == t) == false, "eq compare should fail"); assert(t.at(0) == "s", "at on text");