!7
set flag NoHTML. // tt
p-exp {
new NotifyingStringBuffer buf;
final Var count = new(0);
buf.onChange = ll(r { incIntVar(count) });
assertEquals(0L, buf.changes);
buf.append("yo");
assertEquals(1L, buf.changes);
buf.append(' ');
buf.append("what");
assertEquals(3L, buf.changes);
assertEquals(3, count!);
assertEqualsVerbose("yo what", str(buf));
buf.setLength(2);
assertEquals(4, count!);
assertEqualsVerbose("yo", str(buf));
}