summaryrefslogtreecommitdiffstats
path: root/0000-don-t-check-Po-file-content-on-bigendian.patch
blob: dc094608c42c1eb4bf0a3dc45240f8443cf11e85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From aadd696ee850da3e3e387dd32b9406905cd14e2b Mon Sep 17 00:00:00 2001
From: Randy Barlow <randy@electronsweatshop.com>
Date: Mon, 15 Jan 2018 15:59:10 -0500
Subject: [PATCH] don't check Po file content on bigendian

Patch originally written by Remi Collet[0], and adapted for
Gettext 4.4.3 by Randy Barlow.

Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
---
 tests/AbstractTest.php | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/AbstractTest.php b/tests/AbstractTest.php
index 42f54b6..42f419f 100644
--- a/tests/AbstractTest.php
+++ b/tests/AbstractTest.php
@@ -51,7 +51,10 @@ abstract class AbstractTest extends PHPUnit_Framework_TestCase
         $method = "to{$format}String";
         $content = file_get_contents(static::asset($file.'.'.static::$ext[$format]));
 
-        $this->assertSame($content, $translations->$method(), $file);
+        // Po reference files are LittleEndian
+        if ($format !== 'Mo' || self::isLittleEndian()) {
+            $this->assertSame($content, $translations->$method(), $file);
+        }
     }
 
     protected static function saveContent(Translations $translations, $file, $format = null)
@@ -78,4 +81,9 @@ abstract class AbstractTest extends PHPUnit_Framework_TestCase
         $this->assertSame($countTranslated, $translations->countTranslated());
         $this->assertContent($translations, $file);
     }
+
+    protected function isLittleEndian()
+    {
+        return pack("s", 0x3031) === "10";
+    }
 }
-- 
2.16.1