# parameter should have that period as well.
idna_test() {
- n=`expr $n + 1`
+ n=$((n+1))
description=$1
if [ "$2" != "" ]; then
description="${description}: $2"
ret=1
fi
fi
- status=`expr $status + $ret`
+ status=$((status+ret))
}
# Function for performing a test where "dig" is expected to fail
# $3 - Name being queried
idna_fail() {
- n=`expr $n + 1`
+ n=$((n+1))
description=$1
if [ "$2" != "" ]; then
description="${description}: $2"
echo_i "failed: dig command unexpectedly succeeded"
ret=1
fi
- status=`expr $status + $ret`
+ status=$((status+ret))
}
# Function to check that case is preserved for an all-ASCII label.
idna_fail "$text" "+idnin +noidnout" "$label"
idna_fail "$text" "+idnin +idnout" "$label"
-
-
-
# Tests of a valid unicode string but an invalid U-label (input)
#
# Symbols are not valid IDNA2008 names. Check whether dig rejects them
idna_test "$text" "+noidnin +noidnout" "xn--19g" "xn--19g."
idna_fail "$text" "+noidnin +idnout" "xn--19g"
idna_fail "$text" "+idnin +idnout" "xn--19g"
+
+ # Test that the UseSTD3ASCIIRules is being used
+ #
+ # Note that "+noidnin +idnout" is not tested because libidn2 2.2.0+ parses
+ # Punycode more strictly than older versions and thus dig succeeds with that
+ # combination of options with libidn2 2.2.0+ but fails with older
+ # versions.
+ #
+ # Note that "+idnin +idnout" is not tested because libidn2 2.2.0+ parses
+ # Punycode more strictly than older versions and thus dig fails with that
+ # combination of options with libidn2 2.2.0+ but succeeds with older
+ # versions.
+ #
+ # With UseSTD13ASCIIRules=false, '☺' produces 'xn--\032o-oia59s'
+ #
+ # With UseSTD13ASCIIRules=true, '☺' produces 'xn--o-vfa'
+
+ text="Check that UseSTD3ASCIIRules is being used"
+ idna_test "$text" "" "☺" "\195\162\203\156\194\186."
+ idna_test "$text" "+noidnin +noidnout" "☺" "\195\162\203\156\194\186."
+ # idna_test "$text" "+noidnin +idnout" "☺" "xn--o-vfa."
+ idna_test "$text" "+idnin +noidnout" "☺" "xn--o-vfa."
+ # idna_fail "$text" "+idnin +idnout" "☺" "âo."
}