Improve and test Path implementation #21
Labels
No Label
bug
code-quality
documentation
duplicate
enhancement
feature
flair
invalid
on-hold
release
third-party bug
tooling
wontfix
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: tools/josh#21
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The implementation of
Path
should be tested. A testing framework has been set up but it is not currently being used.Testing the
Path
interface will probably reveal some flaws in the usage ofPath
. I believe the way it is currently used is suboptimal and there should be other ways to use it. For example, it should not be necessary to callnew Path(path).path
to optimise a path, and it should be possible to callgetNode(path: string): string
on aDirectory
withpath
set todir1/dir2/file
to simplify file retrieval. (Though this will require path optimisation before calling this method since a directory does not know its parent and can therefore not retrieve../file
.)Changing the
FileSystem
's_cwd
field to aPath
should also be considered, though I'm not sure this is feasible/useful/better.Finally, as is already listed in some
TODO
s, the fields ofPath
should be turned into getters.Issues with
Path
's implementation become especially apparent when looking at the code forcp
andmv
infs.ts
.Funky things start happening. Consider the following undesirable behaviours:
cp -r . .
in root will create a subdirectory/
in root. This should not be possible.mkdir /
in root will create a subdirectory/
in root. This should not be possible.mkdir .
in root will create a subdirectory/
in root. This should not be possible.cd personal
and thencp ../resume.pdf ./
will give the errorThe file resume.pdf already exists
. This is incorrect.