Hi there,
I just wrote a file duplicate finder where I'm not quite sure how to
build up my test cases.
The problem is that most of my test cases are impure. They rely upon a
directory layout.
What is the best way to do this? Should I create a directory structure
containing most (or better all) of
On Dec 22, 2013, at 1:54 PM, Manfred Lotz wrote:
> Hi there,
> I just wrote a file duplicate finder where I'm not quite sure how to
> build up my test cases.
>
> The problem is that most of my test cases are impure. They rely upon a
> directory layout.
>
> What is the best way to do this? Shoul
Manfred Lotz wrote at 12/22/2013 01:54 PM:
Or perhaps even better create my directory structure on the fly and
build my test cases upon this?
Yes, like that. It can be tedious to develop, but then your test suite
is more likely to work when you or someone else needs it to.
I suggest bu
On Sun, 22 Dec 2013 14:04:40 -0500
Matthias Felleisen
wrote:
>
> On Dec 22, 2013, at 1:54 PM, Manfred Lotz wrote:
>
> > Hi there,
> > I just wrote a file duplicate finder where I'm not quite sure how to
> > build up my test cases.
> >
> > The problem is that most of my test cases are impure. T
You should also consider structuring your code such that the code that
actually touches the filesystem is separate from the logic that does
whatever your program does. Then you can plug in a "fake" filesystem that
just implements the same api as the real code, but that also does some
specific, smal
Yes. There is a (simple) hidden file/directory simulator in the works inside of
2htdp/batch-io for novices to test such things. Nothing you could use but
Robby's right and his message recalled my (aborted) effort from last year --
Matthias
On Dec 22, 2013, at 3:52 PM, Robby Findler wrote:
On Sun, 22 Dec 2013 14:52:55 -0600
Robby Findler
wrote:
> You should also consider structuring your code such that the code that
> actually touches the filesystem is separate from the logic that does
> whatever your program does. Then you can plug in a "fake" filesystem
> that just implements the
It can require significant refactoring to separate out the filesystem uses
and so you may consider it too painful, but it really does make for better
code and you don't have to deal with the filesystem anywhere near as much.
Robby
On Sun, Dec 22, 2013 at 10:19 PM, Manfred Lotz wrote:
> On Sun,
On Sun, Dec 22, 2013 at 2:49 PM, Neil Van Dyke wrote:
> Manfred Lotz wrote at 12/22/2013 01:54 PM:
>> Or perhaps even better create my directory structure on the fly and
>> build my test cases upon this?
> Yes, like that. It can be tedious to develop, but then your test suite is
> more likely to
On Mon, 23 Dec 2013 13:53:05 -0500
Greg Hendershott
wrote:
> On Sun, Dec 22, 2013 at 2:49 PM, Neil Van Dyke
> wrote:
> > Manfred Lotz wrote at 12/22/2013 01:54 PM:
> >> Or perhaps even better create my directory structure on the fly and
> >> build my test cases upon this?
> > Yes, like that. It
On Dec 23, 2013, at 2:10 PM, Manfred Lotz wrote:
> On Mon, 23 Dec 2013 13:53:05 -0500
> Greg Hendershott
> wrote:
>
>> On Sun, Dec 22, 2013 at 2:49 PM, Neil Van Dyke
>> wrote:
>>> Manfred Lotz wrote at 12/22/2013 01:54 PM:
Or perhaps even better create my directory structure on the fly
On Mon, 23 Dec 2013 14:29:31 -0500
Matthias Felleisen
wrote:
>
>
> On Dec 23, 2013, at 2:10 PM, Manfred Lotz
> wrote:
>
> > On Mon, 23 Dec 2013 13:53:05 -0500
> > Greg Hendershott
> > wrote:
> >
> >> On Sun, Dec 22, 2013 at 2:49 PM, Neil Van Dyke
> >> wrote:
> >>> Manfred Lotz wrote at 12/
For that, you will need to wrap the whole loop because (in-directory ...)
fails, and no, I don't know how to resume this optimized loop:
#lang racket ;; foo.rkt
(define start-dir ".")
;;
(with-handlers (((lambda (x) #t) (lambda (e) (log-warning "in-directory
failed"
(for ([f (in-direc
On Mon, 23 Dec 2013 15:20:32 -0500
Matthias Felleisen
wrote:
>
> For that, you will need to wrap the whole loop because
> (in-directory ...) fails, and no, I don't know how to resume this
> optimized loop:
>
> #lang racket ;; foo.rkt
>
> (define start-dir ".")
>
> ;;
> (with-handlers (((lam
I had a look into collects/racket/private/for.rkt where in-directory is
defined.
I have to admit that I don't understand much of the stuff as this is a
level of Racket I haven't yet mastered.
Nevertheless, there is
(when (directory-exists? fp)
(loop fp p)
Here it should be
Sadly, I think you may have to re-implement in-directory (with a recursive
traversal like the one in for.rkt) but use file-or-directory-permission
before you try to go into a subdirectory. -- Matthias
On Dec 23, 2013, at 4:09 PM, Manfred Lotz wrote:
> I had a look into collects/racket/privat
On Mon, 23 Dec 2013 16:44:03 -0500
Matthias Felleisen
wrote:
>
> Sadly, I think you may have to re-implement in-directory (with a
> recursive traversal like the one in for.rkt) but use
> file-or-directory-permission before you try to go into a
> subdirectory. -- Matthias
>
>
>
Yep, I did it
On Dec 23, 2013, at 5:12 PM, Manfred Lotz wrote:
> I think in-directory should be fixed in the long run.
Agreed. -- Matthias
Racket Users list:
http://lists.racket-lang.org/users
Perhaps in-directory can take an optional parameter that controls whether
or not to recur?
Robby
On Mon, Dec 23, 2013 at 4:42 PM, Matthias Felleisen wrote:
>
> On Dec 23, 2013, at 5:12 PM, Manfred Lotz wrote:
>
> > I think in-directory should be fixed in the long run.
>
> Agreed. -- Matthias
>
If you don't have permissions, you can't recur and the current implementation
throws an error w/o recourse to a fix. As Manfred points out, this is a 'fair
weather' function. A real implementation should resist such external mishaps.
But I also agree w/ you about the parameter. It would general
I don't think the proposed fix would "resist" in this manner. The directory
could be deleted between the time you check for its existence and when you
ask for its contents.
Robby
On Mon, Dec 23, 2013 at 7:05 PM, Matthias Felleisen wrote:
>
> If you don't have permissions, you can't recur and th
On Mon, 23 Dec 2013 20:51:16 -0600
Robby Findler
wrote:
> I don't think the proposed fix would "resist" in this manner. The
> directory could be deleted between the time you check for its
> existence and when you ask for its contents.
>
I would differentiate between static and dynamic errors.
I'll add support for an optional directory-filtering function to
`in-directory`.
At Tue, 24 Dec 2013 05:24:50 +0100, Manfred Lotz wrote:
> On Mon, 23 Dec 2013 20:51:16 -0600
> Robby Findler
> wrote:
>
> > I don't think the proposed fix would "resist" in this manner. The
> > directory could be de
23 matches
Mail list logo