xref: /aosp_15_r20/external/toybox/tests/comm.test (revision cf5a6c84e2b8763fc1a7db14496fd4742913b199)
1*cf5a6c84SAndroid Build Coastguard Worker#!/bin/bash
2*cf5a6c84SAndroid Build Coastguard Worker
3*cf5a6c84SAndroid Build Coastguard Worker[ -f testing.sh ] && . testing.sh
4*cf5a6c84SAndroid Build Coastguard Worker
5*cf5a6c84SAndroid Build Coastguard Worker#testing "name" "command" "result" "infile" "stdin"
6*cf5a6c84SAndroid Build Coastguard Worker
7*cf5a6c84SAndroid Build Coastguard Workerecho -e 'a\nb\nc'> lhs
8*cf5a6c84SAndroid Build Coastguard Workerfor i in c d e ; do echo $i >> rhs ; done
9*cf5a6c84SAndroid Build Coastguard Workertesting "comm" "comm lhs input" "a\nb\n\t\tc\n\td\n\te\n" "c\nd\ne\n" ""
10*cf5a6c84SAndroid Build Coastguard Workertesting "comm -" "comm - input" "a\nb\n\t\tc\n\td\n\te\n" "c\nd\ne\n" "a\nb\nc\n"
11*cf5a6c84SAndroid Build Coastguard Workertesting "comm -123 detects missing" "comm - missing 2>/dev/null || echo here" \
12*cf5a6c84SAndroid Build Coastguard Worker  "here\n" "" ""
13