Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3486)

Issue 80540043: testing/filetesting: new package

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 1 month ago by fwereade
Modified:
10 years ago
Reviewers:
mp+212811, rog
Visibility:
Public.

Description

testing/filetesting: new package ...extracted from utils/zip, and given some actual tests, which (surprise surprise) made a few problems apparent. https://code.launchpad.net/~fwereade/juju-core/filetesting-package/+merge/212811 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 2

Patch Set 2 : testing/filetesting: new package #

Total comments: 11

Patch Set 3 : testing/filetesting: new package #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+651 lines, -199 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
A testing/filetesting/filetesting.go View 1 2 1 chunk +194 lines, -0 lines 2 comments Download
A testing/filetesting/filetesting_test.go View 1 2 1 chunk +283 lines, -0 lines 0 comments Download
A testing/filetesting/package_test.go View 1 chunk +14 lines, -0 lines 0 comments Download
M utils/file_test.go View 1 2 1 chunk +13 lines, -0 lines 0 comments Download
M utils/file_unix.go View 1 2 2 chunks +13 lines, -0 lines 2 comments Download
M utils/file_windows.go View 1 2 1 chunk +6 lines, -0 lines 0 comments Download
M utils/zip/package_test.go View 1 1 chunk +0 lines, -103 lines 0 comments Download
M utils/zip/zip_test.go View 9 chunks +126 lines, -96 lines 0 comments Download

Messages

Total messages: 7
fwereade
Please take a look.
10 years, 1 month ago (2014-03-26 09:59:56 UTC) #1
fwereade
Please take a look.
10 years, 1 month ago (2014-03-27 09:18:20 UTC) #2
rog
Looks nice; a few comments and suggestions below. https://codereview.appspot.com/80540043/diff/1/testing/filetesting/filetesting.go File testing/filetesting/filetesting.go (right): https://codereview.appspot.com/80540043/diff/1/testing/filetesting/filetesting.go#newcode26 testing/filetesting/filetesting.go:26: var ...
10 years, 1 month ago (2014-03-27 09:39:24 UTC) #3
fwereade
Please take a look. https://codereview.appspot.com/80540043/diff/1/testing/filetesting/filetesting.go File testing/filetesting/filetesting.go (right): https://codereview.appspot.com/80540043/diff/1/testing/filetesting/filetesting.go#newcode26 testing/filetesting/filetesting.go:26: var _ Entry = Dir{} ...
10 years ago (2014-04-02 08:42:53 UTC) #4
rog
https://codereview.appspot.com/80540043/diff/20001/testing/filetesting/filetesting.go File testing/filetesting/filetesting.go (right): https://codereview.appspot.com/80540043/diff/20001/testing/filetesting/filetesting.go#newcode24 testing/filetesting/filetesting.go:24: // a copy of the receiver. On 2014/04/02 08:42:53, ...
10 years ago (2014-04-03 11:34:19 UTC) #5
rog
LGTM, BTW.
10 years ago (2014-04-03 11:34:30 UTC) #6
fwereade
10 years ago (2014-04-03 16:39:56 UTC) #7
https://codereview.appspot.com/80540043/diff/20001/testing/filetesting/filete...
File testing/filetesting/filetesting.go (right):

https://codereview.appspot.com/80540043/diff/20001/testing/filetesting/filete...
testing/filetesting/filetesting.go:24: // a copy of the receiver.
On 2014/04/03 11:34:19, rog wrote:
> On 2014/04/02 08:42:53, fwereade wrote:
> > On 2014/03/27 09:39:24, rog wrote:
> > > What's the point of returning a copy of the receiver? all your
> implementations
> > > are by-value anyway, so it's really a no-op.
> > 
> > Compactness in use -- it actually got really annoying not being able to do:
> > 
> > foo := File{...}.Create(...)
> > 
> > foos := Entries{
> >     ...
> >     ...
> > }.Create(...)
> 
> personally i think that:
> 
>    foo := File{...}
>    foo.Create(...)
> 
> reads just as naturally and is only one extra line, but fair enough. it's a
pity
> about the extra code to do it though (i bet you spend more lines of code here
> than you save elsewhere)
> 

IMO it ends up looking icky in cases where you're setting up/checking a bunch of
entries, and sometimes you want to capture a var, and sometimes you don't. It's
not really about lines of code -- I think you'd win that bet :).

https://codereview.appspot.com/80540043/diff/40001/testing/filetesting/filete...
File testing/filetesting/filetesting.go (right):

https://codereview.appspot.com/80540043/diff/40001/testing/filetesting/filete...
testing/filetesting/filetesting.go:192: c.Assert(err, jc.Satisfies,
utils.IsNotExist)
On 2014/04/03 11:34:19, rog wrote:
> ?

Commented.

https://codereview.appspot.com/80540043/diff/40001/utils/file_unix.go
File utils/file_unix.go (right):

https://codereview.appspot.com/80540043/diff/40001/utils/file_unix.go#newcode20
utils/file_unix.go:20: // reference a file that does not exist.
On 2014/04/03 11:34:19, rog wrote:
> Perhaps add a comment that says why this is different from os.IsNotExist?

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b