guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: website: tests: Fix position of expected value in tests cases.


From: Luis Felipe López Acevedo
Subject: 01/01: website: tests: Fix position of expected value in tests cases.
Date: Tue, 5 Mar 2019 18:18:13 -0500 (EST)

lfla pushed a commit to branch master
in repository guix-artwork.

commit 6d0e6868722b70039c9031009a9041c6c8a8859b
Author: sirgazil <address@hidden>
Date:   Tue Mar 5 18:12:36 2019 -0500

    website: tests: Fix position of expected value in tests cases.
    
    Almost all test cases had the expected value and test-expr in the
    opposite order.
    
    * website/tests/apps/aux/lists.scm
    * website/tests/apps/aux/numbers.scm
    * website/tests/apps/aux/strings.scm
    * website/tests/apps/aux/sxml.scm
    * website/tests/apps/aux/system.scm
    * website/tests/apps/aux/web.scm
    * website/tests/apps/base/types.scm
    * website/tests/apps/blog/utils.scm
---
 website/tests/apps/aux/lists.scm   | 48 ++++++++++++++++----------------
 website/tests/apps/aux/numbers.scm | 18 ++++++------
 website/tests/apps/aux/strings.scm | 12 ++++----
 website/tests/apps/aux/sxml.scm    |  8 +++---
 website/tests/apps/aux/system.scm  | 16 +++++------
 website/tests/apps/aux/web.scm     | 36 +++++++++++++-----------
 website/tests/apps/base/types.scm  |  4 +--
 website/tests/apps/blog/utils.scm  | 56 ++++++++++++++++++--------------------
 8 files changed, 99 insertions(+), 99 deletions(-)

diff --git a/website/tests/apps/aux/lists.scm b/website/tests/apps/aux/lists.scm
index 8c63f24..be048ec 100644
--- a/website/tests/apps/aux/lists.scm
+++ b/website/tests/apps/aux/lists.scm
@@ -31,48 +31,48 @@
  "[procedure] list-group"
  (test-equal
   "Grouping elements of an empty list results in an empty list."
-  (list-group (list) 5)
-  (list))
+  (list)
+  (list-group (list) 5))
  (test-equal
   "Group a list of four in sets of two."
-  (list-group (list "Onnet" "Twoson" "Threed" "Summers") 2)
-  (list (list "Onnet" "Twoson") (list "Threed" "Summers")))
+  (list (list "Onnet" "Twoson") (list "Threed" "Summers"))
+  (list-group (list "Onnet" "Twoson" "Threed" "Summers") 2))
  (test-equal
   "Group a list of five in sets of three."
-  (list-group (list "Onnet" "Twoson" "Threed" "Summers" "Scaraba") 3)
-  (list (list "Onnet" "Twoson" "Threed") (list "Summers" "Scaraba"))))
+  (list (list "Onnet" "Twoson" "Threed") (list "Summers" "Scaraba"))
+  (list-group (list "Onnet" "Twoson" "Threed" "Summers" "Scaraba") 3)))
 
 
 (test-group
  "[procedure] list-slice"
  (test-equal
   "Slice from index A to index B."
-  (list-slice fruit-bag 0 2)
-  (list "uva" "mora"))
+  (list "uva" "mora")
+  (list-slice fruit-bag 0 2))
  (test-equal
   "Slice from index A to index B out of range."
-  (list-slice fruit-bag 1 7)
-  (list "mora" "mango" "kiwi"))
+  (list "mora" "mango" "kiwi")
+  (list-slice fruit-bag 1 7))
  (test-equal
   "Slice from index A."
-  (list-slice fruit-bag 2)
-  (list "mango" "kiwi")))
+  (list "mango" "kiwi")
+  (list-slice fruit-bag 2)))
 
 
 (test-group
  "[procedure] rest"
  (test-equal
   "Empty list results in itself."
-  (rest (list))
-  (list))
+  (list)
+  (rest (list)))
  (test-equal
   "Rest of single-element list is empty list."
-  (rest (list "Hello"))
-  (list))
+  (list)
+  (rest (list "Hello")))
  (test-equal
   "Rest of list of elements is the list but its first element."
-  (rest (list "Hello" "Hola" "Ei"))
-  (list "Hola" "Ei")))
+  (list "Hola" "Ei")
+  (rest (list "Hello" "Hola" "Ei"))))
 
 
 (test-group
@@ -80,18 +80,18 @@
 
  (test-equal
   "Don't add separators to empty lists."
-  (separate (list) "|")
-  (list))
+  (list)
+  (separate (list) "|"))
 
  (test-equal
   "Don't add separators to one-element lists."
-  (separate (list "mango") "|")
-  (list "mango"))
+  (list "mango")
+  (separate (list "mango") "|"))
 
  (test-equal
   "Separate the elements of a list."
-  (separate (list "mango" "kiwi" "papaya" "lemon") "|")
-  (list "mango" "|" "kiwi" "|" "papaya" "|" "lemon")))
+  (list "mango" "|" "kiwi" "|" "papaya" "|" "lemon")
+  (separate (list "mango" "kiwi" "papaya" "lemon") "|")))
 
 
 (test-end SUITE_NAME)
diff --git a/website/tests/apps/aux/numbers.scm 
b/website/tests/apps/aux/numbers.scm
index 10db180..8c4241c 100644
--- a/website/tests/apps/aux/numbers.scm
+++ b/website/tests/apps/aux/numbers.scm
@@ -22,31 +22,29 @@
 
 (test-group
  "[procedure] minus-one"
- (test-equal "0 minus 1" (minus-one 0) -1)
- (test-equal "6 minus 1" (minus-one 6) 5))
+ (test-equal "0 minus 1" -1 (minus-one 0))
+ (test-equal "6 minus 1" 5 (minus-one 6)))
 
 
 (test-group
  "[procedure] plus-one"
- (test-equal "0 plus one." (plus-one 0) 1)
- (test-equal "5 plus one." (plus-one 5) 6))
+ (test-equal "0 plus one." 1 (plus-one 0))
+ (test-equal "5 plus one." 6 (plus-one 5)))
 
 
 (test-group
  "[procedure] range"
  (test-equal
   "Range with equal start and end."
-  (range 8 8) (list 8))
+  (list 8) (range 8 8))
  (test-equal
   "Range of positive integers."
-  (range 0 5) (list 0 1 2 3 4 5))
+  (list 0 1 2 3 4 5) (range 0 5))
  (test-equal
   "Range of negative integers."
-  (range -5 0) (list -5 -4 -3 -2 -1 0))
+  (list -5 -4 -3 -2 -1 0) (range -5 0))
  (test-equal
   "Range of negative and positive integers."
-  (range -5 5) (list -5 -4 -3 -2 -1 0 1 2 3 4 5))
- )
-
+  (list -5 -4 -3 -2 -1 0 1 2 3 4 5) (range -5 5)))
 
 (test-end SUITE_NAME)
diff --git a/website/tests/apps/aux/strings.scm 
b/website/tests/apps/aux/strings.scm
index 264e03b..01d4771 100644
--- a/website/tests/apps/aux/strings.scm
+++ b/website/tests/apps/aux/strings.scm
@@ -27,22 +27,22 @@
 
  (test-equal
   "Return an empty string if there are no words."
-  (string-summarize "" 10)
-  "")
+  ""
+  (string-summarize "" 10))
 
  (test-equal
   "Return the orginal string when there are less words than the required 
number."
+  "GNU Guix will be present at FOSDEM next month with talks on a number of 
areas of active development."
   (string-summarize
    "GNU Guix will be present at FOSDEM next month with talks on a number of 
areas of active development."
-   40)
-  "GNU Guix will be present at FOSDEM next month with talks on a number of 
areas of active development.")
+   40))
 
  (test-equal
   "Return an extract with the required number of words."
+  "Last week we were celebrating the release of GNU Guile 2.2.0, the Scheme 
implementation that powers Guix. This is a major milestone and Guile developers 
naturally wanted to make it"
   (string-summarize
    "Last week we were celebrating the release of GNU Guile 2.2.0, the Scheme 
implementation that powers Guix. This is a major milestone and Guile developers 
naturally wanted to make it easy for users to discover all the goodies of 2.2.0 
as soon as possible. One of the major roadblocks to that, as for any 
non-trivial piece of software, is deployment: because your distro is unlikely 
to have Guile 2.2.0 packaged on Day 1, you have to build it by yourself, which 
means getting the right depen [...]
-   30)
-  "Last week we were celebrating the release of GNU Guile 2.2.0, the Scheme 
implementation that powers Guix. This is a major milestone and Guile developers 
naturally wanted to make it"))
+   30)))
 
 
 (test-end SUITE_NAME)
diff --git a/website/tests/apps/aux/sxml.scm b/website/tests/apps/aux/sxml.scm
index 4d1616a..798e558 100644
--- a/website/tests/apps/aux/sxml.scm
+++ b/website/tests/apps/aux/sxml.scm
@@ -27,14 +27,14 @@
 
  (test-equal
   "Converting an empty SXML tree results in an empty string."
-  (sxml->string* '())
-  "")
+  ""
+  (sxml->string* '()))
 
  (test-equal
   "Convert non-empty SXML tree to string."
+  "Hello Earth. We are writing from Mars."
   (sxml->string*
-   '(p "Hello " (span (@ (class "planet")) "Earth") ". We are writing from " 
(a (@ (href "https://mars.org/";)) "Mars") "."))
-  "Hello Earth. We are writing from Mars."))
+   '(p "Hello " (span (@ (class "planet")) "Earth") ". We are writing from " 
(a (@ (href "https://mars.org/";)) "Mars") "."))))
 
 
 (test-end SUITE_NAME)
diff --git a/website/tests/apps/aux/system.scm 
b/website/tests/apps/aux/system.scm
index f121ebe..9d00c13 100644
--- a/website/tests/apps/aux/system.scm
+++ b/website/tests/apps/aux/system.scm
@@ -27,26 +27,26 @@
 
  (test-equal
   "Build a relative path to a file."
-  (path-join "docs" "essays" "humanity.odt")
   (string-join (list "docs" "essays" "humanity.odt")
-              file-name-separator-string))
+              file-name-separator-string)
+  (path-join "docs" "essays" "humanity.odt"))
 
  (test-equal
   "Build an absolute path to a directory."
-  (path-join "" "en" "docs" "manual")
   (string-join (list "" "en" "docs" "manual")
-              file-name-separator-string))
+              file-name-separator-string)
+  (path-join "" "en" "docs" "manual"))
 
  (test-equal
   "Append a slash to the end of the path when specified."
-  (path-join "" "docs" "manual" "")
   (string-join (list "" "docs" "manual" "")
-              file-name-separator-string))
+              file-name-separator-string)
+  (path-join "" "docs" "manual" ""))
 
  (test-equal
   "Build path to the root directory."
-  (path-join "")
-  file-name-separator-string))
+  file-name-separator-string
+  (path-join "")))
 
 
 (test-end SUITE_NAME)
diff --git a/website/tests/apps/aux/web.scm b/website/tests/apps/aux/web.scm
index 78bc20c..a9cbc36 100644
--- a/website/tests/apps/aux/web.scm
+++ b/website/tests/apps/aux/web.scm
@@ -25,21 +25,25 @@
 (test-group
  "[procedure] slugify"
 
- (test-assert
+ (test-equal
   "Text is lowercase."
-  (equal? (slugify "Biology") "biology"))
+  "biology"
+  (slugify "Biology"))
 
- (test-assert
+ (test-equal
   "Separate words with a hyphen."
-  (equal? (slugify "Human anatomy") "human-anatomy"))
+  "human-anatomy"
+  (slugify "Human anatomy"))
 
- (test-assert
+ (test-equal
   "Remove reserved characters for IRIs."
-  (equal? (slugify ":/address@hidden&'()*+,;=") ""))
+  ""
+  (slugify ":/address@hidden&'()*+,;="))
 
- (test-assert
+ (test-equal
   "Remove reserved characters for file names."
-  (equal? (slugify ":/?*\\%\"|<>") "")))
+  ""
+  (slugify ":/?*\\%\"|<>")))
 
 
 
@@ -48,23 +52,23 @@
 
  (test-equal
   "Build a relative path to a web resource."
-  (url-path-join "blog" "tags" "index.html")
-  "blog/tags/index.html")
+  "blog/tags/index.html"
+  (url-path-join "blog" "tags" "index.html"))
 
  (test-equal
   "Build an absolute path to a directory."
-  (url-path-join "" "en" "docs" "manual")
-  "/en/docs/manual")
+  "/en/docs/manual"
+  (url-path-join "" "en" "docs" "manual"))
 
  (test-equal
   "Append a slash to the end of the path when specified."
-  (url-path-join "" "docs" "manual" "")
-  "/docs/manual/")
+  "/docs/manual/"
+  (url-path-join "" "docs" "manual" ""))
 
  (test-equal
   "Build a path to the root directory."
-  (url-path-join "")
-  "/"))
+  "/"
+  (url-path-join "")))
 
 
 (test-end SUITE_NAME)
diff --git a/website/tests/apps/base/types.scm 
b/website/tests/apps/base/types.scm
index 15a72a3..4c37f66 100644
--- a/website/tests/apps/base/types.scm
+++ b/website/tests/apps/base/types.scm
@@ -27,8 +27,8 @@
 
  (test-equal
   "Return the appropriate value for the given key in the context."
-  (context-datum '(("HEALTH" . 82) ("COOKIE" . "lemon")) "COOKIE")
-  "lemon"))
+  "lemon"
+  (context-datum '(("HEALTH" . 82) ("COOKIE" . "lemon")) "COOKIE")))
 
 
 (test-end SUITE_NAME)
diff --git a/website/tests/apps/blog/utils.scm 
b/website/tests/apps/blog/utils.scm
index eb5d3fb..9fb3bce 100644
--- a/website/tests/apps/blog/utils.scm
+++ b/website/tests/apps/blog/utils.scm
@@ -30,17 +30,17 @@
 
  (test-equal
   "Return an empty list if there are no grouped posts."
-  (post-groups->tag-list '())
-  '())
+  '()
+  (post-groups->tag-list '()))
 
  (test-equal
   "Return the list of tag names from the grouped posts."
+  '("Scheme API" "Unit tests" "Releases")
   (post-groups->tag-list
    (list
     (cons "Scheme API" '())
     (cons "Unit tests" '())
-    (cons "Releases" '())))
-  '("Scheme API" "Unit tests" "Releases")))
+    (cons "Releases" '())))))
 
 
 (test-group
@@ -48,10 +48,10 @@
 
  (test-equal
   "Return the correct URL path to the post."
+  "blog/2017/hello-world"
   (post-url-path (make-post "hello.md"
                            `((title . "Hello World!")
-                             (date . ,(make-date* 2017 03 21))) '()))
-  "blog/2017/hello-world"))
+                             (date . ,(make-date* 2017 03 21))) '()))))
 
 
 (test-group
@@ -59,57 +59,55 @@
 
  (test-equal
   "Return an empty list when there are no posts."
-  (posts/latest '() 5)
-  '())
+  '()
+  (posts/latest '() 5))
 
  (test-equal
   "Return all posts when there are less posts than the required number."
-  (length (posts/latest (list (make-post "hello.md" '() '())) 3))
-  1)
+  1
+  (length (posts/latest (list (make-post "hello.md" '() '())) 3)))
 
  (test-equal
   "Return the required number of posts."
+  2
   (length (posts/latest
           (list
            (make-post "hello.md" `((date . ,(make-date* 2017 03 21))) '())
            (make-post "hola.md" `((date . ,(make-date* 2017 03 21))) '())
            (make-post "konchiwa.md" `((date . ,(make-date* 2017 03 21))) '())
            (make-post "bye.md" `((date . ,(make-date* 2017 03 21))) '()))
-          2))
-  2)
+          2)))
 
  (test-equal
   "Return all posts when there are less posts than the required number."
-  (length (posts/latest (list (make-post "hello.md" '() '())) 3))
-  1)
+  1
+  (length (posts/latest (list (make-post "hello.md" '() '())) 3)))
 
  (test-equal
   "Return the required number of posts sorted in reverse chronological order."
+  (list
+   (make-post "bye.md" `((date . ,(make-date* 2017 03 20))) '())
+   (make-post "konchiwa.md" `((date . ,(make-date* 2017 03 09))) '())
+   (make-post "hola.md" `((date . ,(make-date* 2017 01 17))) '()))
   (posts/latest
    (list
     (make-post "hello.md" `((date . ,(make-date* 2015 12 01))) '())
     (make-post "hola.md" `((date . ,(make-date* 2017 01 17))) '())
     (make-post "konchiwa.md" `((date . ,(make-date* 2017 03 09))) '())
     (make-post "bye.md" `((date . ,(make-date* 2017 03 20))) '()))
-   3)
-  (list
-   (make-post "bye.md" `((date . ,(make-date* 2017 03 20))) '())
-   (make-post "konchiwa.md" `((date . ,(make-date* 2017 03 09))) '())
-   (make-post "hola.md" `((date . ,(make-date* 2017 01 17))) '()))))
+   3)))
 
 
 (test-group
  "[procedure] tag-first?"
 
- (test-equal
+ (test-assert
   "The tag 'Alpha' goes before 'Gamma'."
-  (tag-first? "Alpha" "Gamma")
-  #true)
+  (tag-first? "Alpha" "Gamma"))
 
- (test-equal
+ (test-assert
   "The tag 'Zapato' does not go before 'Abeja'."
-  (tag-first? "Zapato" "Abeja")
-  #false))
+  (not (tag-first? "Zapato" "Abeja"))))
 
 
 (test-group
@@ -117,8 +115,8 @@
 
  (test-equal
   "Return the system path to the tag relative to the website dir."
-  (tag-system-path "Programming interfaces")
-  "blog/tags/programming-interfaces"))
+  "blog/tags/programming-interfaces"
+  (tag-system-path "Programming interfaces")))
 
 
 (test-group
@@ -126,8 +124,8 @@
 
  (test-equal
   "Return the URL path to the tag."
-  (tag-url-path "Scheme API")
-  "blog/tags/scheme-api"))
+  "blog/tags/scheme-api"
+  (tag-url-path "Scheme API")))
 
 
 (test-end SUITE_NAME)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]