summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMaxime Devos <maximedevos@telenet.be>2021-07-14 13:12:46 +0200
committerMathieu Othacehe <othacehe@gnu.org>2021-07-14 15:38:03 +0200
commitef71965c162ff19c7b4b85889b0330d7c428dda5 (patch)
tree0c68d09690f4b32bbee991317dfbf9106e0e82d5 /tests
parentb4ccf3df0bb141da4301c6937e5e6660a29d4727 (diff)
downloadguix-ef71965c162ff19c7b4b85889b0330d7c428dda5.tar.gz
utils: Define 'target-linux?' predicate.
* guix/utils.scm (target-linux?): New predicate.
* tests/utils.scm
  ("target-linux?"): Test it.
  ("target-mingw?"): Also test ‘target-mingw?’.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/utils.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/utils.scm b/tests/utils.scm
index 7fcbb25552..e170070907 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -289,6 +290,22 @@ skip these tests."
    (string-closest "hello" '("kikoo" "helo" "hihihi" "halo"))
    (string-closest "hello" '("aaaaa" "12345" "hellohello" "h"))))
 
+(test-equal "target-linux?"
+  '(#t #f #f #t)
+  (map target-linux?
+       '("i686-linux-gnu" "i686-w64-mingw32"
+         ;; Checking that "gnu" is present is not sufficient,
+         ;; as GNU/Hurd exists.
+         "i686-pc-gnu"
+         ;; Some targets have a suffix.
+         "arm-linux-gnueabihf")))
+
+(test-equal "target-mingw?"
+  '(#f #f #t)
+  (map target-mingw?
+       '("i686-linux-gnu" "i686-pc-gnu"
+         "i686-w64-mingw32")))
+
 (test-end)
 
 (false-if-exception (delete-file temp-file))