[latex3-commits] [l3svn] branch master updated: Allow for Unix/Win line ending differences in file tests

noreply at latex-project.org noreply at latex-project.org
Mon Jul 10 10:08:31 CEST 2017


This is an automated email from the git hooks/post-receive script.

joseph pushed a commit to branch master
in repository l3svn.

The following commit(s) were added to refs/heads/master by this push:
       new  3ceeb4f   Allow for Unix/Win line ending differences in file tests
3ceeb4f is described below

commit 3ceeb4f12e2022a2a57ec7b0edfe557ffcb9da52
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Jul 10 09:06:00 2017 +0100

    Allow for Unix/Win line ending differences in file tests
    
    As we checkout with line endings normalised for the host platform,
    the exact details of the file size and hash we see varies.
    
    One could deal with the hash by doing a string read of the entire
    thing then reporting the hash for those tokens, as the 'back end'
    will then have normalised the endings. However, that takes longer
    and doesn't really fit with being 'file' ops.
---
 l3kernel/testfiles/m3file001.lvt       |   28 ++++++++++++++++++++++------
 l3kernel/testfiles/m3file001.ptex.tlg  |    7 +------
 l3kernel/testfiles/m3file001.tlg       |    7 +------
 l3kernel/testfiles/m3file001.uptex.tlg |    7 +------
 l3kernel/testfiles/m3file001.xetex.tlg |    6 ------
 5 files changed, 25 insertions(+), 30 deletions(-)

diff --git a/l3kernel/testfiles/m3file001.lvt b/l3kernel/testfiles/m3file001.lvt
index 96b9914..1f0a4de 100644
--- a/l3kernel/testfiles/m3file001.lvt
+++ b/l3kernel/testfiles/m3file001.lvt
@@ -143,17 +143,33 @@
 
 \TEST { Getting~file~information }
   {
-    \OMIT
-      \cs_generate_variant:Nn \regex_match:nnTF { nV }
-    \TIMO
     \file_get_hash:nN { filetest-utf8.txt } \l_tmpa_str
-    \tl_show:N \l_tmpa_str
+    \file_get_size:nN { filetest.txt }      \l_tmpb_str
+    \sys_if_engine_xetex:F
+      {
+        \int_compare:nNnTF \l_tmpb_str = { 120 }
+          {
+            % Unix line endings
+            \str_if_eq:VnTF \l_tmpa_str { 4F918CB10404DD50E3C1B9990FF54D4A }
+              \TRUE \ERROR
+          }
+          {
+            \int_compare:nNnTF \l_tmpb_str = { 123 }
+              {
+                 % Windows line endings
+                \str_if_eq:VnTF \l_tmpa_str { FA408C34EC7616533C50F8643B7949B6 }
+                  \TRUE \ERROR
+              }
+              \ERROR
+          }
+      }
     \file_get_hash:nN { NotAFile.txt } \l_tmpa_str
     \tl_show:N \l_tmpa_str
-    \file_get_size:nN { filetest.txt } \l_tmpa_str
-    \tl_show:N \l_tmpa_str
     \file_get_size:nN { NotAFile.txt } \l_tmpa_str
     \tl_show:N \l_tmpa_str
+    \OMIT
+      \cs_generate_variant:Nn \regex_match:nnTF { nV }
+    \TIMO
     \file_get_timestamp:nN { filetest.txt } \l_tmpa_str
     \regex_match:nVTF
       { ^D\:\d{14} } \l_tmpa_tl \TRUE \ERROR
diff --git a/l3kernel/testfiles/m3file001.ptex.tlg b/l3kernel/testfiles/m3file001.ptex.tlg
index 5e88459..51ece3a 100644
--- a/l3kernel/testfiles/m3file001.ptex.tlg
+++ b/l3kernel/testfiles/m3file001.ptex.tlg
@@ -229,15 +229,10 @@ l. ...  }
 ============================================================
 TEST 9: Getting file information
 ============================================================
-> \l_tmpa_str=4F918CB10404DD50E3C1B9990FF54D4A.
-<recently read> }
-l. ...  }
+TRUE
 > \l_tmpa_str=.
 <recently read> }
 l. ...  }
-> \l_tmpa_str=120.
-<recently read> }
-l. ...  }
 > \l_tmpa_str=.
 <recently read> }
 l. ...  }
diff --git a/l3kernel/testfiles/m3file001.tlg b/l3kernel/testfiles/m3file001.tlg
index f000a49..ffb6260 100644
--- a/l3kernel/testfiles/m3file001.tlg
+++ b/l3kernel/testfiles/m3file001.tlg
@@ -223,15 +223,10 @@ l. ...  }
 ============================================================
 TEST 9: Getting file information
 ============================================================
-> \l_tmpa_str=4F918CB10404DD50E3C1B9990FF54D4A.
-<recently read> }
-l. ...  }
+TRUE
 > \l_tmpa_str=.
 <recently read> }
 l. ...  }
-> \l_tmpa_str=120.
-<recently read> }
-l. ...  }
 > \l_tmpa_str=.
 <recently read> }
 l. ...  }
diff --git a/l3kernel/testfiles/m3file001.uptex.tlg b/l3kernel/testfiles/m3file001.uptex.tlg
index 77aac84..658db36 100644
--- a/l3kernel/testfiles/m3file001.uptex.tlg
+++ b/l3kernel/testfiles/m3file001.uptex.tlg
@@ -229,15 +229,10 @@ l. ...  }
 ============================================================
 TEST 9: Getting file information
 ============================================================
-> \l_tmpa_str=4F918CB10404DD50E3C1B9990FF54D4A.
-<recently read> }
-l. ...  }
+TRUE
 > \l_tmpa_str=.
 <recently read> }
 l. ...  }
-> \l_tmpa_str=120.
-<recently read> }
-l. ...  }
 > \l_tmpa_str=.
 <recently read> }
 l. ...  }
diff --git a/l3kernel/testfiles/m3file001.xetex.tlg b/l3kernel/testfiles/m3file001.xetex.tlg
index 1f89b92..7cd1baa 100644
--- a/l3kernel/testfiles/m3file001.xetex.tlg
+++ b/l3kernel/testfiles/m3file001.xetex.tlg
@@ -223,12 +223,6 @@ l. ...  }
 ============================================================
 TEST 9: Getting file information
 ============================================================
-> \l_tmpa_str=4F918CB10404DD50E3C1B9990FF54D4A.
-<recently read> }
-l. ...  }
-> \l_tmpa_str=.
-<recently read> }
-l. ...  }
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !
 ! LaTeX error: "kernel/xetex-primitive-not-available"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the latex3-commits mailing list