D5239: tests: replace `tac` reimplementation by `sort -r`

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Nov 7 18:30:29 UTC 2018


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  `sort -r` is better code "formatter" than `tac` since it's
  stable. It's also portable so we don't need to reimplement it in
  Python.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5239

AFFECTED FILES
  tests/test-fix.t

CHANGE DETAILS

diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -1,11 +1,6 @@
 A script that implements uppercasing of specific lines in a file. This
 approximates the behavior of code formatters well enough for our tests.
 
-  $ TAC="$TESTTMP/tac.py"
-  $ cat > $TAC <<EOF
-  > import sys
-  > print('\n'.join(sys.stdin.read().splitlines()[::-1]))
-  > EOF
   $ UPPERCASEPY="$TESTTMP/uppercase.py"
   $ cat > $UPPERCASEPY <<EOF
   > import sys
@@ -1122,7 +1117,7 @@
   $ printf "first\nsecond\n" > bar.txt
   $ hg add -q
   $ hg fix -w --config fix.sometool:fileset=bar.txt \
-  >           --config fix.sometool:command="$PYTHON $TAC"
+  >           --config fix.sometool:command="sort -r"
   the fix.tool:fileset config name is deprecated; please rename it to fix.tool:pattern
 
   $ cat foo.whole



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list