Arc Forumnew | comments | leaders | submitlogin
4 points by akkartik 2939 days ago | link | parent

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)))
  )

  (test)

  $ ./arc.sh x.arc
  Can't coerce  #<procedure: cut> string
    context...:
     anarki/ac.scm:1015:0: ar-coerce
      map1
      map1
      string
     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 2938 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: https://bitbucket.org/zck/unit-test.arc/commits/bb41b4183938.... Can you re-pull (hg pull; hg update) and see if it works then? The most recent commit is 96652e5.

-----

3 points by akkartik 2938 days ago | link

Ah, you're right. Looks great now!

-----