aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/lf/lf-make-map/tests/cases/dot_dirs/test.sh
blob: d3df848cef13821dffe29199256d44c58fb1fb07 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /usr/bin/env sh

# nixos-config - My current NixOS configuration
#
# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of my nixos-config.
#
# You should have received a copy of the License along with this program.
# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.

mkFile() {
    t="$1"

    mkdir --parents "$(dirname "$t")"
    echo "TEST_FILE" >"$t"
}

# We need to hard code this, so that our output matches the golden sample.
base="/tmp/tmp.DfcgjemfCG"
test="$(mktemp --directory -t lf_make_temp_test_XXXXX)"

if [ -d "$base" ]; then
    rm --recursive "$base"
fi
mkdir "$base"

cleanup() {
    rm --recursive "$base" "$test"
}
trap cleanup EXIT

mkFile "$base/.local/share/file1.txt"
mkFile "$base/.local/state/file1.txt"
mkFile "$base/.local/nvim/log.LOG"
mkFile "$base/.local/.tog/TOG.LOG"

mkFile "$base/.config/apzu/file2.txt"
mkFile "$base/.config/tiamat/file2.txt"
mkFile "$base/.config/lahmu/file2.txt"

mkFile "$base/documents/apzu/file2.txt"
mkFile "$base/documents/tiamat/file2.txt"
mkFile "$base/documents/lahmu/file2.txt"

execute_make_maps --home-name "$base" --depth 100 generate "$base/.local" "$base/.config" "$base/documents" >"$test/output.new"

diff "$test/output.new" "$(dirname "$LOCATION")/output.old"