jerry gay wrote on Mon, Aug 20, 2007 at 07:17:07AM PDT:
...
perhaps it's not explicit enough in the description, but
Fsprintf_tests is copied directly from perl's repository. modifying
this file is not recommended, as future synchronizations from a newer
perl will likely overwrite previous parrot customizations. instead, i
suggest t/op/sprintf.t be modified to handle multiple files, and a new
file (perhaps Fsprintf_parrot) be created including the new test
data.
Thanks, Jerry. I think it's explicit about it being copied, but I
didn't think of it being synchronized again. I have attached a new patch
which follows your suggestion and creates sprintf_parrot and adds it to
the files that t/op/sprint.t uses. I have also updated the
documentation. The patch must be applied after the rt38992-1.patch.
diffstat:
t/op/sprintf.t | 18 +-
t/op/sprintf_parrot | 20
t/op/sprintf_tests | 19 ---
3 files changed, 33 insertions(+), 24 deletions(-)
- David
--
/All/ Christians -- 'that they all may be one' -- are to be one. It is
obvious that there can be no organizational unity which could include
all born-again Christians everywhere in the world. It is just not
possible.
-- Francis Schaeffer, The Mark of a Christian
diff --git a/t/op/sprintf.t b/t/op/sprintf.t
index f1e1878..62912dd 100644
--- a/t/op/sprintf.t
+++ b/t/op/sprintf.t
@@ -8,17 +8,24 @@ t/op/sprintf.t -- sprintf tests
=head1 DESCRIPTION
-These tests are based on sprintf tests from perl 5.9.4.
-
Tests sprintf, excluding handling of 64-bit integers or long
doubles (if supported), of machine-specific short and long
integers, machine-specific floating point exceptions (infinity,
not-a-number ...), of the effects of locale, and of features
specific to multi-byte characters (under the utf8 pragma and such).
-Individual tests are stored in the Csprintf_tests file in the same
-directory; There is one test per line. In each test, there are three
-required fields:
+Individual tests are stored in either Csprintf_tests or Csprintf_parrot in
+the same directory. The tests in the Csprintf_tests file are based on
+sprintf tests from perl 5.9.4. Only change that file to synchronize with perl
+5.x.x releases. The tests in the Csprintf_parrot file are parrot-specific
+sprintf tests, and can be changed. Simply put, change Csprintf_parrot, not
+Csprintf_tests.
+
+=head2 Test file structure
+
+As stated above, individual tests are stored in either Csprintf_tests or
+Csprintf_parrot in the same directory; there is one test per line. In each
+test, there are three required fields:
=over 4
@@ -88,6 +95,7 @@ tag 'all' is allowed for todo tests that should fail on any
system
# populate the list of test files
push test_files, 'sprintf_tests'
+push test_files, 'sprintf_parrot'
.local pmc file_iterator # iterate over list of files..
diff --git a/t/op/sprintf_parrot b/t/op/sprintf_parrot
new file mode 100644
index 000..cd96ff4
--- /dev/null
+++ b/t/op/sprintf_parrot
@@ -0,0 +1,20 @@
+Hello, %s\nParrot! Hello, Parrot!\nstring substitution w/chars
before
+Hash[0x%x]\n 256 Hash[0x100]\n hex format good
+Hash[0x%lx]\n 256 Hash[0x100]\n long-hex format
+Hello, %.2s!\n Parrot Hello, Pa!\ntruncated string sub w/chars before
+Hello, %Ss Hello, Pa!\nHello, Hello, Pa!\n
+1 == %Pd\n 1 1 == 1\ndec subst
+-255 == %vd\n -255-255 == -255\n signed (negative) dec subst
++123 == %+vd\n 123 +123 == +123\n signed dec subst
+256 == %vu\n 256 256 == 256\nunsigned subst
+1 == %+vu\n1 1 == 1\nunsigned subst 2
+001 == %0.3u\n 1 001 == 001\nformatted unsigned subst
+001 == %+0.3u\n1 001 == 001\nformatted unsigned subst 2
+0.50 == %f\n 0.5 0.50 == 0.50\n default float subst
+0.500 == %5.3f\n 0.5 0.500 == 0.500\nformatted float subst
+0.001 == %g\n 0.001 0.001 == 0.001\ndouble subst
+1e+06 == %g\n 1.0e6 1e+06 == 1e+06\ndouble subst
+0.5 == %3.3g\n 0.5 0.5 == 0.5\nformatted double subst
+%% == %%\n 0 % == %\nno subst
+That's all, %s\n folks! That's all, folks!\n
+
diff --git a/t/op/sprintf_tests b/t/op/sprintf_tests
index 0baf56c..322fcec 100644
--- a/t/op/sprintf_tests
+++ b/t/op/sprintf_tests
@@ -307,24 +307,5 @@
%#x0 0
%2147483647$v2d''
%*2147483647$v2d '' UNINIT
-Hello, %s\nParrot! Hello, Parrot!\nstring substitution w/chars
before
-Hash[0x%x]\n 256 Hash[0x100]\n hex format good
-Hash[0x%lx]\n 256 Hash[0x100]\n long-hex format
-Hello, %.2s!\n Parrot Hello, Pa!\ntruncated string sub w/chars before
-Hello, %Ss Hello, Pa!\nHello, Hello, Pa!\n
-1 == %Pd\n 1 1 == 1\ndec subst
--255 == %vd\n -255-255 == -255\n signed (negative) dec subst
-+123 == %+vd\n 123 +123 ==