tests.lisp 1.94 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11

(require 'rt)
(in-package #:rt)

 ;; translations when language is bound to NIL

(setf translate:*resolution-time* :run-time)

(deftest translate.nil-lang.1
    (apply #'values
           (let ((translate:*language* nil))
Daniel Kochmański's avatar
Daniel Kochmański committed
12 13
             (mapcar #'(lambda (x y) (or (equal x y)
                                         (list  x y)))
14 15 16 17 18 19 20
                     (list #t"phrase-1" #t"phrase-2" #t"phrase-3")
                     (list   "phrase-1"   "phrase-2"   "phrase-3"))))
  T T T)

(deftest translate.nil-lang.2
    (apply #'values
           (let ((translate:*language* nil))
Daniel Kochmański's avatar
Daniel Kochmański committed
21 22
           (mapcar #'(lambda (x y) (and (equal x y)
                                        (list  x y)))
23 24 25 26
                   '(#t"phrase-1" #t"phrase-2" #t"phrase-3")
                   '(  "phrase-1"   "phrase-2"   "phrase-3"))))
  NIL NIL NIL)

Daniel Kochmański's avatar
Daniel Kochmański committed
27 28
(setf translate:*language* nil
      translate:*resolution-time* :load-time)
29 30 31

(deftest translate.nil-lang.3
    (apply #'values
Daniel Kochmański's avatar
Daniel Kochmański committed
32 33
           (mapcar #'(lambda (x y) (or (equal x y)
                                         (list  x y)))
34 35 36 37 38 39
                   (list #t"phrase-1" #t"phrase-2" #t"phrase-3")
                   (list   "phrase-1"   "phrase-2"   "phrase-3")))
  T T T)

(deftest translate.nil-lang.4
    (apply #'values
Daniel Kochmański's avatar
Daniel Kochmański committed
40 41
           (mapcar #'(lambda (x y) (or (equal x y)
                                         (list  x y)))
42 43 44 45 46 47 48 49 50 51 52 53 54 55
                   '(#t"phrase-1" #t"phrase-2" #t"phrase-3")
                   '(  "phrase-1"   "phrase-2"   "phrase-3")))
  T T T)

 ;; translations for defined language

(setf translate:*resolution-time* :run-time)

(translate:define-language 'en
    "phrase-1" "Phrase one")

(deftest translate.en-lang.1
    (apply #'values
           (let ((translate:*language* 'en))
Daniel Kochmański's avatar
Daniel Kochmański committed
56 57
             (mapcar #'(lambda (x y) (or (equal x y)
                                         (list  x y)))
58 59 60 61 62
                     (list #t"phrase-1"   #t"phrase-2" #t"phrase-3")
                     (list   "Phrase one"  "{phrase-2}" "{phrase-3}"))))
  T T T)