"Try it now"

Sequ user at example.net
Thu Apr 14 02:42:56 PDT 2011


> bearophile wrote:
> > This is a problem. Unittest code is not meant to produce an output,
> > while online snippets to try are meant to nearly always produce a
> > meaningful output.
> ...

> assert(sort([4, 2]) == [2, 4]);
>
> does look pretty neat. I guess the alternative is:
>
> writeln(sort[4, 2]); // prints "[2, 4]"
> ...

> But, regardless, there's nothing much my compile helper and
> javascript can do here. The examples in the documentation would
> have to be changed.

Is it maybe possible for the Javascript to take all statements of the form:
assert(a == b);
and rewrite them (in the Source Code window that pops up) as:
writeln(a);
?
I'm sure something could be written that works for most of the code found
in the documentation (even if it doesn't work for all possible D code).


More information about the Digitalmars-d mailing list