This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test that perl.c reports {non_,}bincompat_options in sorted order.
authorNicholas Clark <nick@ccl4.org>
Wed, 23 Feb 2011 11:06:46 +0000 (11:06 +0000)
committerNicholas Clark <nick@ccl4.org>
Wed, 23 Feb 2011 11:06:46 +0000 (11:06 +0000)
Whilst the actual order doesn't matter semantically, ensuring that they are
always in a sorted order means that string comparison can be used to validate
that two sets of options are identical. This will be useful in the near future
for improved load-time extension compatibility checking.

MANIFEST
t/porting/bincompat.t [new file with mode: 0644]

index e63078e..468bbec 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -4996,6 +4996,7 @@ t/op/yadayada.t                   See if ... works
 t/perl.supp                    Perl valgrind suppressions
 t/porting/args_assert.t                Check that all PERL_ARGS_ASSERT* macros are used
 t/porting/authors.t            Check that all authors have been acknowledged
+t/porting/bincompat.t          Check that {non_,}bincompat_options are ordered
 t/porting/buildtoc.t           Check that various pod lists are consistent
 t/porting/checkcase.t          Check whether we are case-insensitive-fs-friendly
 t/porting/cmp_version.t                Test whether all changed module files have their VERSION bumped
diff --git a/t/porting/bincompat.t b/t/porting/bincompat.t
new file mode 100644 (file)
index 0000000..f65fe37
--- /dev/null
@@ -0,0 +1,18 @@
+#!./perl -w
+use strict;
+require './test.pl';
+
+use Config;
+
+plan(2);
+
+# Defiantely a white box test...
+
+# As we need to call it direct, we'll take advantage of its result ordering:
+my @to_check = qw(bincompat_options non_bincompat_options);
+my @V = map {s/^ //r} Internals::V();
+
+while (my ($index, $sub) = each @to_check) {
+    my $got = join ' ', &{Config->can($sub)}();
+    is($got, $V[$index], "C source code has $sub in sorted order");
+}