Closed 4lph4-Ph4un closed 6 years ago
Any tips? :D Anyone?
Hello there,
it would be nice to be able to split some of the code into other modules.
Looks like you think "one file = one module", are you ? But this is not necessary. I didn't get exactly what you want to break, but it seems to me you could just use several files, and place them into the same package. Write defpackage
once, and (in-package #:master-class-test-types)
in any file. They would just have to be declared in order in the .asd.
To discuss more, I suggest stack overflow/code review, since this isn't specifically about Prove.
Also, Rove by the same author is seen as the continuation of Prove. It is at least better at showing error traces, where Prove doesn't show much.
Ah, Thankyou! I'll check what you just suggested! :) The issue is not strictly about files needing to be separate modules, but rather how to split code over multiple files and retain the the output as it would've been produced by the non-modular code in the upper example (the output of tests having subtests of subtests where declared):
The lower part of the upper example:
(subtest "CHARACTER and STRING types:"
(let ((fixture-char-a #\f)
(fixture-char-b #\o)
(fixture-char-c #\o))
(subtest (format nil "CHARACTERS are prefixed with \"#\\\" (EG):~@
~@T- ~@C~@
~@T- ~@C~@
~@T- ~@C"
fixture-char-a
fixture-char-b
fixture-char-c)
(is-type fixture-char-a 'character)
(is-type fixture-char-b 'character)
(is-type fixture-char-c 'character)))
(let ((fixture-string-foo "foo")
(fixture-string-bar "bar"))
(subtest (format
nil
"Strings are encapsulated with double quotes (E.G):~@
~@T- ~S~@
~@T- ~S"
fixture-string-foo
fixture-string-bar)
(is-type fixture-string-foo 'string)
(is-type fixture-string-bar 'string))))
How to keep this subtest on it's original file while getting child subtests from another?
(subtest "CHARACTER and STRING types:"
;; The stuff that used to be here is now on different file
)
macros ?
or a simpler organization ;)
Simpler organization doesn't really cut it if the output must be a hierarchical list of outputs, i think? But that was the point of the original question. Which was to contemplate does Prove employ any direct feature for such? Therefore I find answers containing "change your specification for outcome" totally unhelpful (if I indeed gathered that correctly along the lines ;) ). What would be a good source to find out information how to create such macros that would enable this structure? It's really all about learning!
Hmmm! Just encapsulated the needed subtests into a macro and that did the trick! Everything runs nice and smoothly! Thanks for the tip! The sheer malleability and flexibility of Lisp doesn't seize to amaze me! :)
Hi! I'm fairly new to Lisps and I'm currently using Prove to get a good headstart by writing a set of learning tests of the CLisp -language properties. As you can image, for learning one would like to implement test hierarchically to get a nice indented output per topics and subtopics. However my testfiles are getting quite long already so it would be nice to be able to split some of the code into other modules. How can this be done. let's assume there's something simple like this:
Now for brewitiy if I would like to break file contents more like:
I tried tampering with asdf -modules but the issue with them is that I cannot get the output and test order to preserve the topical hierarchy I'm aiming for.