FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Improve tests for ln -s with relative source arguments · Issue #835 · shelljs/shelljs · GitHub

Improve tests for ln -s with relative source arguments #835

Description

Also inspired by #833.

ln -s is weird in that the semantics differ depending on whether it's given a relative path or an absolute path. For example:

$ touch file.txt
$ mkdir dir/
$ # Create a link, with an absolute path
$ ln -s "$PWD/file.txt" absoluteLink # ./absoluteLink is non-broken
$ mv absoluteLink dir/ # ./dir/absoluteLink is still non-broken
$ # Create a link, with a relative path
$ ln -s ./file.txt relativeLink # ./relativeLink is currently non-broken
$ mv relativeLink dir/ # But now ./dir/relativeLink is broken

I think shelljs does the right thing, but I'm not sure if our tests obviously handle this.

We should also consider making this explicit, but adding a utility function like utils.symlinkIsBroken(pathToLink).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL