mm(1): fixes bug with -a; mm.1, tests/mm.mk: changes to test regression in -a and -t

This commit is contained in:
2025-11-02 01:12:27 -06:00
parent 544b544d84
commit feac3bf4f8
3 changed files with 27 additions and 4 deletions

View File

@@ -1,10 +1,12 @@
# Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
# Copyright (c) 20242025 Emma Tebibyte <emma@tebibyte.media>
# SPDX-License-Identifier: FSFAP
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice and
# this notice are preserved. This file is offered as-is, without any warranty.
MM_FILE!=mktemp /tmp/mm.XXXXXX
.PHONY: mm_tests
mm_tests: mm_args mm_help mm_stderr mm_remaining mm_remaining_options
@@ -38,3 +40,18 @@ mm_remaining: $(BIN)/mm
mm_remaining_options:
! $(BIN)/mm -i README COPYING -o - 2>&1 | cut -d: -f2 \
| xargs test " -o" =
.PHONY: mm_append
mm_append:
$(BIN)/mm -i /dev/null -o $(MM_FILE)
printf 'test\nstring\nmulti-line\n' | $(BIN)/mm -o $(MM_FILE)
printf 'new line\n' | $(BIN)/mm -a -o $(MM_FILE)
$(BIN)/mm -i $(MM_FILE) | wc -l | xargs test 4 -eq
.PHONY: mm_no_truncate
mm_no_truncate:
$(BIN)/mm -i /dev/null -o $(MM_FILE)
printf 'test\nstring\nmulti-line\n' | $(BIN)/mm -o $(MM_FILE)
printf 'new line\n' | $(BIN)/mm -t -o $(MM_FILE)
$(BIN)/mm -i $(MM_FILE) | wc -l | xargs test 3 -eq