Re: 1.524

"H.Merijn Brand" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
On Mon, 25 Mar 2013 11:51:09 +0000, Tim Bunce <[email protected]>
wrote:

> On Sun, Mar 24, 2013 at 09:08:33PM +0100, H.Merijn Brand wrote:
> > PASSes on all my boxes but one
> > 
> > The failing box has JSON::XS installed (temporary to check Schmorp's
> > claims, for which I so far found no proof)
> > 
> > The formatted output - I might have an output patch applied to make the
> > output style meet our requirements - causes this mismatch.
> 
> Am I right in thinking that the goal of the JSON::XS test is to check
> whether JSON::XS puts quotes around values?

Note that up to now I never had JSON::XS installed anywhere, so I never
ran that test.

This file is completely mje's work (entered 2009-11-27 18:03:49)
git-svn-id: http://svn.perl.org/modules/dbi/trunk@13615 50811bd7-b8ce-0310-adc1-d9db26280581

Commit messages since

    Tests for DBI::sql_type_cast - not necessarily finished but wanted to let
      Tim see them.

    Fix test count and tidy output for a full make test - disable warnings when
    we expect them, remove diag calls

    Needs SQL types and DBIstcf_XXX

    Fix tests for conversions to IV on machines where IVs are 8 bytes
    was testing longsize and it should have been ivsize

    Added DBIstcf_STRICT and DBIstcf_DISCARD_STRING to DBI::PurePerl.
    Added rough draft of sql_type_cast to DBI::PurePerl.
    Fixed typo in Changes.
    Removed DBI:: prefixes from t/90sql_type_cast.t
    (Some tests still fail)

    Some tests cannot be performed with PurePerl e.g., DiscardString (skipped)
    and number overflows do not work the same (don't overflow).

    Omit some tests on Perl < 5.10.1 due to a change in sv_2nv.

    Fixed "Argument "aa" isn't numeric in addition" warnings from t/zvp_90sql_type_cast.t
    Only warn in PurePerl sql_type_cast if warnings are enabled.

> I'd suggest adding s/\s+//g, plus a comment, to make that explicit.

I think I agree, but I'd like to hear Martin's voice

> Tim.
> 
> > I don't mind when the verdict is: we cannot expect people to alter
> > whitespacing in module output, but having cpanprefs not only makes that
> > easy, but make installing a lot of modules suddenly become more logical
> > as I can "fix" the decisions the author made that I do not agree with.
> > 
> > Personally I don't think prettied output checks in tests should ever
> > test on whitespace (including newlines) unless the output is completely
> > generated by the module itself or guaranteed by the module or its
> > documentation to not add or remove whitespace.
> > 
> > The change to prevent this specific case is maybe somthing like
> > --8<---
> > --- a/t/90sql_type_cast.t 2013-03-24 21:00:02.167352360 +0100
> > +++ b/t/90sql_type_cast.t 2013-03-24 21:05:07.251376420 +0100
> > @@ -116,7 +116,7 @@ foreach my $test(@tests) {
> >              skip 'DiscardString not supported in PurePerl', 1
> >                  if $pp && ($test->[3] & DBIstcf_DISCARD_STRING);
> > 
> > -            my $json = JSON::XS->new->encode([$val]);
> > +            (my $json = JSON::XS->new->encode([$val])) =~ s/\s+]$/]/;;
> >              #diag(neat($val), ",", $json);
> >              is($json, $test->[5], "json $test->[0]");
> >          };
> > -->8---
> > 
> > but it doesn't catch changes that generate extra spaces output as
> > like "  [  99  ] "
> > 
> > For me, the tests will pass again next week, as JSON::XS will be banned
> > to trash again
> > 
> > t/87gofer_cache.t ............... ok
> > t/90sql_type_cast.t ............. 1/45
> > #   Failed test 'json undef'
> > #   at t/90sql_type_cast.t line 121.
> > #          got: '[null   ]'
> > #     expected: '[null]'
> > 
> > #   Failed test 'json invalid sql type'
> > #   at t/90sql_type_cast.t line 121.
> > #          got: '["99"   ]'
> > #     expected: '["99"]'
> > 
> > #   Failed test 'json non numeric cast to int'
> > #   at t/90sql_type_cast.t line 121.
> > #          got: '["aa"   ]'
> > #     expected: '["aa"]'
> > 
> > #   Failed test 'json non numeric cast to int (strict)'
> > #   at t/90sql_type_cast.t line 121.
> > #          got: '["aa"   ]'
> > #     expected: '["aa"]'
> > 
> > #   Failed test 'json small int cast to int'
> > #   at t/90sql_type_cast.t line 121.
> > #          got: '["99"   ]'
> > #     expected: '["99"]'
> > 
> > #   Failed test 'json 2 byte max signed int cast to int'
> > #   at t/90sql_type_cast.t line 121.
> > #          got: '["32767"   ]'
> > #     expected: '["32767"]'
> > 
> > #   Failed test 'json 2 byte max unsigned int cast to int'
> > #   at t/90sql_type_cast.t line 121.
> > #          got: '["65535"   ]'

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.17   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.