diff --git a/tests/fixtures/without-netmask.interfaces b/tests/fixtures/without-netmask.interfaces new file mode 100644 index 0000000..7537c67 --- /dev/null +++ b/tests/fixtures/without-netmask.interfaces @@ -0,0 +1,5 @@ +iface v6 + address 2001:470:1f10::1 + +iface v4 + address 203.0.113.2 diff --git a/tests/ifquery_test b/tests/ifquery_test index 92a4b6b..8aded63 100755 --- a/tests/ifquery_test +++ b/tests/ifquery_test @@ -36,7 +36,9 @@ tests_init \ vlan_complex_learned_dependency \ wireguard \ allow_undefined_positive \ - allow_undefined_negative + allow_undefined_negative \ + default_netmask_v4 \ + default_netmask_v6 noargs_body() { atf_check -s exit:1 -e ignore ifquery -S/dev/null @@ -242,3 +244,15 @@ allow_undefined_negative_body() { -e ignore \ ifquery -i /dev/null -p address foo } + +default_netmask_v4_body() { + atf_check -s exit:0 \ + -o match:"203.0.113.2/24" \ + ifquery -i $FIXTURES/without-netmask.interfaces -p address v4 +} + +default_netmask_v6_body() { + atf_check -s exit:0 \ + -o match:"2001:470:1f10::1/64" \ + ifquery -i $FIXTURES/without-netmask.interfaces -p address v6 +}