Test-Command: id3v2 -h
Restrictions: superficial

Test-Command: id3v2 -v
Restrictions: superficial

Test-Command: id3v2 -f debian/tests/silence.mp3

Test-Command: cp debian/tests/silence.mp3 $AUTOPKGTEST_TMP;
              cd $AUTOPKGTEST_TMP;
              id3v2 --TALB 'A little test!' -a Tux -t 'My system' -y 2020 silence.mp3;
              id3v2 -l silence.mp3

# Regression tests for the bugs fixed in 0.1.12+dfsg-10.

# A missing file operand must yield a non-zero exit status (#784064).
# allow-stderr: the diagnostic about the missing file is expected on stderr.
Test-Command: if id3v2 -a x $AUTOPKGTEST_TMP/does-not-exist.mp3; then exit 1; else exit 0; fi
Restrictions: allow-stderr

# Two user-defined-text frames with distinct descriptions must both survive
# (#271311).
Test-Command: cp debian/tests/silence.mp3 $AUTOPKGTEST_TMP/txxx.mp3 &&
              id3v2 -2 --TXXX 'd1:a' $AUTOPKGTEST_TMP/txxx.mp3 &&
              id3v2 -2 --TXXX 'd2:b' $AUTOPKGTEST_TMP/txxx.mp3 &&
              id3v2 -l $AUTOPKGTEST_TMP/txxx.mp3 | grep -q '(d1)' &&
              id3v2 -l $AUTOPKGTEST_TMP/txxx.mp3 | grep -q '(d2)'

# A colon escaped as "\:" must end up as a literal colon in the value
# (#390781, #681847).
Test-Command: cp debian/tests/silence.mp3 $AUTOPKGTEST_TMP/colon.mp3 &&
              id3v2 -c 'From\: x' $AUTOPKGTEST_TMP/colon.mp3 &&
              id3v2 -l $AUTOPKGTEST_TMP/colon.mp3 | grep -q 'From: x'

# A non-MPEG container must be refused with a non-zero exit status (#446427).
# allow-stderr: the "Refusing to tag" diagnostic is expected on stderr.
Test-Command: printf 'RIFF....WAVEfmt ' > $AUTOPKGTEST_TMP/notaudio.wav &&
              if id3v2 -a x $AUTOPKGTEST_TMP/notaudio.wav; then exit 1; else exit 0; fi
Restrictions: allow-stderr

# A cover image can be attached and listed back as an APIC frame (#782767).
Test-Command: cp debian/tests/silence.mp3 $AUTOPKGTEST_TMP/pic.mp3 &&
              printf 'GIF89a small cover bytes' > $AUTOPKGTEST_TMP/cover.gif &&
              id3v2 -p $AUTOPKGTEST_TMP/cover.gif $AUTOPKGTEST_TMP/pic.mp3 &&
              id3v2 -l $AUTOPKGTEST_TMP/pic.mp3 | grep -qi APIC
