#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-or-later

set -euo pipefail

. "$(dirname "$0")/lib.sh"

setup "$1"
plan 3

write_conf "f $TESTDIR/escaped.txt 0644 - - - line1\\nline2"
run_test "create escaped file command" "$SEEDFILES" --create "$TESTDIR/conf"
assert_exists "$TESTDIR/escaped.txt"

expected=$(printf 'line1\nline2')
content="$(cat "$TESTDIR/escaped.txt")"
if [ "$content" = "$expected" ]; then
    ok "escaped content matches"
else
    not_ok "escaped content matches" "got '$content'"
fi

done_testing
