| File: | t/replacement-order.t |
| Coverage: | 100.0% |
| line | stmt | bran | cond | sub | pod | time | code |
|---|---|---|---|---|---|---|---|
| 1 | #!/usr/bin/perl -wl | ||||||
| 2 | |||||||
| 3 | 1 1 1 | 5031 45758 61 | use Test::More; | ||||
| 4 | 1 1 1 | 2317 31218 249 | use Test::Differences; | ||||
| 5 | 1 1 1 | 16 5 179 | use File::Path qw(mkpath rmtree); | ||||
| 6 | 1 1 1 | 962 55539 207 | use File::Slurp; | ||||
| 7 | 1 1 1 | 1093 17797 495986 | use Data::Dumper; | ||||
| 8 | |||||||
| 9 | 1 | 11 | my $BASE = 't/replacement-order'; | ||||
| 10 | 1 | 22 | my $HOME = "$BASE/1"; | ||||
| 11 | 1 | 10 | my $TARGET = "$BASE/2"; | ||||
| 12 | 1 | 6 | my $PREFIX = "u"; | ||||
| 13 | |||||||
| 14 | # Set a debug environment | ||||||
| 15 | 1 | 15 | $ENV{HOME} = $HOME; | ||||
| 16 | |||||||
| 17 | 1 | 1749 | ok( mkpath("$HOME/.foobar/blatest/barba", "$TARGET") ); | ||||
| 18 | |||||||
| 19 | 1 | 1495 | ok( write_file("$BASE/list", 'm d .foo*/bla*/bar* bar%3-bla%2-foo%1') ); | ||||
| 20 | 1 | 2298 | ok( write_file("$BASE/config", "TARGETDIR=$TARGET\nFILELAYOUT=$PREFIX-\%s") ); | ||||
| 21 | |||||||
| 22 | 1 | 2977550 | ok( system(qw(bin/unburden-home-dir -C), "$BASE/config", qw(-L), "$BASE/list" ) == 0 ); | ||||
| 23 | |||||||
| 24 | 1 | 1505 | ok( -d "$TARGET/$PREFIX-barba-blatest-foobar" ); | ||||
| 25 | 1 | 1566 | ok( -l "$HOME/.foobar/blatest/barba" ); | ||||
| 26 | 1 | 1299 | eq_or_diff_text( "$TARGET/$PREFIX-barba-blatest-foobar", | ||||
| 27 | readlink("$HOME/.foobar/blatest/barba"), | ||||||
| 28 | "Symlink points to expected location." ); | ||||||
| 29 | |||||||
| 30 | 1 | 8549 | ok( rmtree("$BASE") ); | ||||
| 31 | |||||||
| 32 | 1 | 1016 | done_testing(); | ||||