[dylan] Reworking testworks-specs

Bruce Mitchener <[email protected]> Mon, 5 Jan 2015 23:49:38 +0700
Newsgroups gmane.comp.lang.dylan.gwydion.devel
Message-ID <CA+esKjNvjV_aQvYPmvWGFhp3ez+JTy96FfRzQY-ajeCOORQGPA@mail.gmail.com>
--===============0885698915==
Content-Type: multipart/alternative; boundary=f46d043c7eb8dc2036050bea7903

--f46d043c7eb8dc2036050bea7903
Content-Type: text/plain; charset=UTF-8

Hello all,

I recently got annoyed with some stuff in testworks-specs and decided to
try to "fix" the implementation.

I have a branch here:

    https://github.com/dylan-lang/testworks/tree/dev/rework-specs

The first thing that it does is to switch away from building up a data
structure and then executing tests manually via with-test-unit. It now
generates the tests via "define test" and "define suite" definers. This
lets it integrate a lot more smoothly with the current versions of
testworks.

One difference is that before, you could have multiple tests for, say,
function a-b from module Y and a-b from module Z in the same test module.
That doesn't work at the moment because I've forgotten how to concatenate
multiple tokens (rather than just a prefix and suffix) in macros.

For example, given:

    define macro class-test-definer
      { define ?protocol-name:name class-test ?class-name:name ()
          ?body:body
        end }
        => { define test "test-class-" ## ?class-name
(requires-assertions?: #f)
               ?body
             end }
    end macro class-test-definer;

I'd love to be able to generate a test named ""test-class-" ##
?protocol-name ## "-" ## ?class-name ... anyone have ideas on how I might
do that?

With these changes, there are no longer any calls with with-test-unit
within the testworks and testworks-specs implementations.

The main way that with-test-unit is used now is stuff like this:

    define common-extensions function-test float-radix ()
      with-test-unit("...")
        ...
      end;
      with-test-unit("...")
        ...
      end;
    end;

My thought is that I can add another macro, say, function-tests or
function-suite, that lets you define tests within it and expands to the
correct suite + tests so that it works well with current testworks. This
should solve a lot of our issues with testworks-specs and the use of
with-test-unit (perhaps allowing us to remove it again).

Thoughts? Comments? Help with that macro problem?

 - Bruce

--f46d043c7eb8dc2036050bea7903
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hello all,</div><div><br></div>I recently got annoyed=
 with some stuff in testworks-specs and decided to try to &quot;fix&quot; t=
he implementation.<div><br></div><div>I have a branch here:</div><div><br><=
/div><div>=C2=A0 =C2=A0 <a href=3D"https://github.com/dylan-lang/testworks/=
tree/dev/rework-specs">https://github.com/dylan-lang/testworks/tree/dev/rew=
ork-specs</a><br><div><br></div><div>The first thing that it does is to swi=
tch away from building up a data structure and then executing tests manuall=
y via with-test-unit. It now generates the tests via &quot;define test&quot=
; and &quot;define suite&quot; definers. This lets it integrate a lot more =
smoothly with the current versions of testworks.</div><div><br></div><div>O=
ne difference is that before, you could have multiple tests for, say, funct=
ion a-b from module Y and a-b from module Z in the same test module. That d=
oesn&#39;t work at the moment because I&#39;ve forgotten how to concatenate=
 multiple tokens (rather than just a prefix and suffix) in macros.</div><di=
v><br></div><div>For example, given:</div><div><br></div><div><div>=C2=A0 =
=C2=A0 define macro class-test-definer</div><div>=C2=A0 =C2=A0=C2=A0=C2=A0 =
{ define ?protocol-name:name class-test ?class-name:name ()</div><div>=C2=
=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 ?body:body</div><div>=C2=A0 =C2=
=A0=C2=A0=C2=A0 =C2=A0 end }</div><div>=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=
=A0=3D&gt; { define test &quot;test-class-&quot; ## ?class-name (requires-a=
ssertions?: #f)</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=
=A0=C2=A0 =C2=A0?body</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 =C2=A0=C2=
=A0=C2=A0=C2=A0end }</div><div>=C2=A0 =C2=A0=C2=A0end macro class-test-defi=
ner;</div></div><div><br></div><div>I&#39;d love to be able to generate a t=
est named &quot;&quot;test-class-&quot; ## ?protocol-name ## &quot;-&quot; =
## ?class-name ... anyone have ideas on how I might do that?</div><div><br>=
</div><div>With these changes, there are no longer any calls with with-test=
-unit within the testworks and testworks-specs implementations.</div><div><=
br></div><div>The main way that with-test-unit is used now is stuff like th=
is:</div><div><br></div><div>=C2=A0 =C2=A0 define common-extensions functio=
n-test float-radix ()<br></div><div>=C2=A0 =C2=A0 =C2=A0 with-test-unit(&qu=
ot;...&quot;)</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ...</div><div>=C2=A0 =
=C2=A0 =C2=A0 end;</div><div>=C2=A0 =C2=A0 =C2=A0 with-test-unit(&quot;...&=
quot;)</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ...</div><div>=C2=A0 =C2=A0 =
=C2=A0 end;</div><div>=C2=A0 =C2=A0 end;<br></div><div><br></div><div>My th=
ought is that I can add another macro, say, function-tests or function-suit=
e, that lets you define tests within it and expands to the correct suite + =
tests so that it works well with current testworks. This should solve a lot=
 of our issues with testworks-specs and the use of with-test-unit (perhaps =
allowing us to remove it again).</div><div><br></div><div>Thoughts? Comment=
s? Help with that macro problem?</div><div><br></div><div>=C2=A0- Bruce</di=
v><div><br></div></div></div>

--f46d043c7eb8dc2036050bea7903--

--===============0885698915==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
hackers mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/hackers

--===============0885698915==--