1#!/bin/sh
2
3# Format: address:expected_channel:expected_nexthop
4# No expectation means no match is expected.
5# Specify "-" to expect an empty string.
6
7echo ==== no wildcard
8${VALGRIND} ./transport 'inline:{rcpt1@example1.com=channel1:nexthop1, rcpt2@example2=channel2:, example3=channel3}' <<'EOF'
9rcpt1@example1.com:channel1:nexthop1
10rcpt1+ext1@example1.com:channel1:nexthop1
11rcpt2@example2:channel2:example2
12rcpt@example3:channel3:example3
13EOF
14
15echo ==== with wildcard channel and nexthop
16${VALGRIND} ./transport 'inline:{*=channel0:nexthop0, rcpt1@example1.com=channel1:nexthop1}' <<'EOF'
17rcpt1@example1.com:channel1:nexthop1
18rcpt2@example2:channel0:nexthop0
19EOF
20
21echo ==== with wildcard channel only
22${VALGRIND} ./transport 'inline:{*=channel0, rcpt1@example1.com=channel1:nexthop1}' <<'EOF'
23rcpt1@example1.com:channel1:nexthop1
24rcpt2@example2:channel0:example2
25EOF
26
27echo ==== with wildcard nexthop only
28${VALGRIND} ./transport 'inline:{*=:nexthop0, rcpt1@example1.com=channel1:nexthop1}' <<'EOF'
29rcpt1@example1.com:channel1:nexthop1
30rcpt2@example2:DEFAULT:nexthop0
31EOF
32
33echo ==== with wildcard empty fields.
34${VALGRIND} ./transport 'inline:{*=:, rcpt1@example1.com=channel1:nexthop1}' <<'EOF'
35rcpt1@example1.com:channel1:nexthop1
36rcpt2@example2:DEFAULT:example2
37EOF
38
39echo === subdomain test
40${VALGRIND} ./transport 'inline:{example=:example-result,.example=:dot-example-result}'  <<'EOF'
41plain1+ext@other-example:
42foo@example:DEFAULT:example-result
43foo@sub.example:DEFAULT:dot-example-result
44foo@sub.sub.example:DEFAULT:dot-example-result
45EOF
46