Arc Forumnew | comments | leaders | submitlogin
Unit-test.arc 1.0 incoming (part II)
3 points by zck 2801 days ago | 7 comments
I previously^1 had announced a beta of 1.0 of unit-test.arc. I got some cool feedback (thanks, akkartik), and I've made the planned changes. I'd like to see if there's any more feedback before I release.

The code can be viewed here^2. The README is up-to-date, and has a good amount of examples. I'd love to hear any comments about it before I release. Thanks.


[2] It's the run-test branch linked to here. If you have the repo checked out, just `hg checkout run-test`.

3 points by akkartik 2797 days ago | link

Ooh, cool! Let me brush the bitrot off my automatic migration script to update the Anarki tests. Maybe we can do a coordinated launch :o)

(Sorry I just saw this. My muscle memory has been getting into this bad habit lately where I visit only the /newcomments page and not the /new page.)


3 points by zck 2797 days ago | link

Heh, no worries. It's taken me, oh, 202 days to update the dang library (I feel like my macro skills have something to be desired, or it would be easier). So no worries about taking four to see this. I was planning on pinging you in a few days if you hadn't seen this.

A coordinated launch would be cool. I'm pretty much ready here; the readme is updated (although it does not explicitly have a version number, which I should add).

But before we get into that, would you mind playing with it a little bit to see if there's anything broken or not working? Thanks.


3 points by akkartik 2797 days ago | link

Hmm, strangely I just sent you a pull request to update the Readme. I'm not too familiar with Mercurial or Bitbucket; maybe I'm doing something wrong?

I'll play with it today or tomorrow and make sure all of Anarki's tests update correctly.


3 points by zck 2796 days ago | link

Yeah, that was right. Thanks for catching the readme changes -- I guess I had made some but not all.


4 points by akkartik 2793 days ago | link

I've updated my script to auto-upgrade Anarki tests[1], and things look pretty good. Just a couple of minor comments:

a) I see a message about redefining assert. Perhaps we should change the name in Anarki or unit-test.arc?

b) The new version complains about duplicate nested suite names inside a test suite. That seems like a reasonable idea, and I just want to confirm that it's intended.

c) If you have a duplicate test name in a suite the error is confusing. Here's the example I ran into from Anarki:

  $ cat x.arc
  (load "unit-test.arc/unit-test.arc")

  (suite cut
    (test finds-element-in-string
      (assert-same '(3 4 5) (cut '(1 2 3 4 5) 2)))
    (test finds-element-in-string        ; duplicate name
      (assert-same "cde" (cut "abcde" 2)))


  $ ./ x.arc
  Can't coerce  #<procedure: cut> string
     anarki/ac.scm:1015:0: ar-coerce
     anarki/ac.scm:1279:0: aload1
Once you switch to unique names everything works fine. But perhaps we can improve the error message?

[1] I'll post the final script here once we "launch".


4 points by zck 2793 days ago | link

Yes, it's a desired feature that a suite can't contain two things with the same name -- either suites, tests, or one suite and one test. This is because I want names to be unique. Saying (test cut.finds-element-in-suite) shuld run only one test.

What you ran into is actually a bug I fixed at a meetup on Tuesday. The current error message is:

  Error: "In suite cut, there are two things named finds-element-in-string."
The commit is here: Can you re-pull (hg pull; hg update) and see if it works then? The most recent commit is 96652e5.


3 points by akkartik 2793 days ago | link

Ah, you're right. Looks great now!