Imported Upstream version 3.001.008
authorgregor herrmann <gregoa@debian.org>
Tue, 5 Aug 2014 17:27:54 +0000 (19:27 +0200)
committergregor herrmann <gregoa@debian.org>
Tue, 5 Aug 2014 17:27:54 +0000 (19:27 +0200)
META.json
META.yml
author_tools/hobodecoder.pl
lib/Sereal/Encoder.pm
t/010_desperate.t
t/lib/Sereal/TestSet.pm

index 5cb0a60c0f1bea42ecd8b9a5eb3e7b5309fd83d8..82c26dc4d56edfe66286af9bace9cf0a3ebbb2c1 100644 (file)
--- a/META.json
+++ b/META.json
@@ -55,5 +55,5 @@
          "url" : "git://github.com/Sereal/Sereal.git"
       }
    },
-   "version" : "3.001_007"
+   "version" : "3.001_008"
 }
index e92ef7578b97c8ebd840bb7efa0d9f002d09c678..47b03f1beae121dfc738585432bc51c5e462d1f1 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -32,4 +32,4 @@ requires:
 resources:
   bugtracker: https://github.com/Sereal/Sereal/issues
   repository: git://github.com/Sereal/Sereal.git
-version: 3.001_007
+version: 3.001_008
index 831f7ae54d7cc67abd0fb918fd0a5d5f0ae1f576..3f1ec2fec4847338923ccb9efd74a126e2726201 100644 (file)
@@ -10,10 +10,12 @@ BEGIN {
     eval '
         use Sereal::Encoder::Constants qw(:all);
         @constants= @Sereal::Encoder::Constants::EXPORT_OK;
+        print "Loaded constants from $INC{q(Sereal/Encoder/Constants.pm)}";
         1;
     ' or do { $err= $@; eval '
         use Sereal::Decoder::Constants qw(:all);
         @constants= @Sereal::Decoder::Constants::EXPORT_OK;
+        print "Loaded constants from $INC{q(Sereal/Decoder/Constants.pm)}";
         1;
     ' } or die "No encoder/decoder constants: $err\n$@";
 }
index c7b1e4e6afa794711623b75b6c02be9d2b373919..31129ea46ce1bb9296dfe2018b916ec51452b5b7 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 use Carp qw/croak/;
 use XSLoader;
 
-our $VERSION = '3.001_007'; # Don't forget to update the TestCompat set for testing against installed decoders!
+our $VERSION = '3.001_008'; # Don't forget to update the TestCompat set for testing against installed decoders!
 our $XS_VERSION = $VERSION; $VERSION= eval $VERSION;
 
 # not for public consumption, just for testing.
index 1cae0d3ee001cf344cae6ecaa6c00d784fb209ed..7a3eb9c6cc424744bc091f1de1f63aa473945903 100644 (file)
@@ -31,13 +31,13 @@ sub run_tests {
   my ($extra_name, $opt_hash) = @_;
   setup_tests(3);
   foreach my $bt (@BasicTests) {
-    my (undef, $exp, $name) = @$bt;
+    my (undef, $expect, $name, $accept_cond, @accept) = @$bt;
 
-    $exp = $exp->($opt_hash) if ref($exp) eq 'CODE';
+    $expect = $expect->($opt_hash) if ref($expect) eq 'CODE';
     $name="unnamed" if not defined $name;
     #next unless $name=~/PAD/;
 
-    $exp = Header(). $exp;
+    $expect = Header(). $expect;
     my $enc = Sereal::Encoder->new($opt_hash ? $opt_hash : ());
     my $out;
     eval{
@@ -45,12 +45,21 @@ sub run_tests {
         1;
     } or die "Failed to encode: \n$@\n". Data::Dumper::Dumper($bt->[0]);
     ok(defined $out, "($extra_name) defined: $name");
-    #is(length($out), length($exp));
-    is(Data::Dumper::qquote($out), Data::Dumper::qquote($exp), "($extra_name) correct: $name")
+
+    if ($accept_cond and $out ne $expect) {
+        foreach my $accept (@accept) {
+            if ($out eq $accept) {
+                diag("Using alternate expect for test '$name'");
+                $expect= $accept;
+                last;
+            }
+        }
+    }
+    is(Data::Dumper::qquote($out), Data::Dumper::qquote($expect), "($extra_name) correct: $name")
       or do {
         if ($ENV{DEBUG_SEREAL}) {
           print STDERR "\nEXPECTED:\n";
-          hobodecode($exp);
+          hobodecode($expect);
           print STDERR "\nGOT:\n";
           hobodecode($out);
           print STDERR "\n";
index 79462986df125bf4c14a54a049e3ae8173ab3a61..d3b9f54a0fd7837b1bf99466984c958e9596715d 100644 (file)
@@ -13,6 +13,7 @@ use Devel::Peek;
 use Encode qw(encode_utf8 is_utf8);
 use Scalar::Util qw(reftype blessed refaddr);
 use Data::Dumper;
+use Config;
 
 # Dynamically load constants from whatever is being tested
 our ($Class, $ConstClass);
@@ -523,7 +524,10 @@ sub setup_tests {
         [
             sub { \@_ }->(!1,!0),
             array(chr(SRL_HDR_FALSE),chr(SRL_HDR_TRUE)),
-            "true/false"
+            "true/false",
+            $Config{usethreads},                            # if this is true
+            array(chr(SRL_HDR_FALSE),chr(0b0000_0001)),     # the we will accept this
+            array(chr(0b0000_0000),chr(0b0000_0001)),       # or this if the test fails.
         ]
     );
 }