logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git

cmp.sh (664B)


  1. #!/bin/sh
  2. # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. target="$(dirname "$0")/../cmd/cmp"
  5. plans=8
  6. . "$(dirname "$0")/tap.sh"
  7. printf foo > foo
  8. printf bar > bar
  9. t foofoo 'foo foo'
  10. t barbar 'bar bar'
  11. t --exit=1 foobar 'foo bar' 'foo bar differ: char 1, line 1
  12. '
  13. t --exit=1 barfoo 'bar foo' 'bar foo differ: char 1, line 1
  14. '
  15. t --exit=1 s_foobar '-s foo bar'
  16. t --exit=1 s_barfoo '-s bar foo'
  17. rm foo bar
  18. seq 1 3 > seq_1_3
  19. seq 1 2 > seq_1_2
  20. t --exit=1 seq_1_3-1_2 'seq_1_3 seq_1_2' 'cmp: error: EOF on seq_1_2 line 3
  21. '
  22. t --exit=1 s_seq_1_3-1_2 '-s seq_1_3 seq_1_2'
  23. rm seq_1_3 seq_1_2