File: string.l

package info (click to toggle)
euslisp 9.32%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 55,268 kB
  • sloc: ansic: 41,693; lisp: 3,339; makefile: 286; sh: 238; asm: 138; python: 53
file content (54 lines) | stat: -rw-r--r-- 1,919 bytes parent folder | download | duplicates (3)
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
43
44
45
46
47
48
49
50
51
52
53
54
;; string.l
;; Author: Yuki Furuta <furushchev@jsk.imi.i.u-tokyo.ac.jp>

(require :unittest "lib/llib/unittest.l")

(init-unit-test)

(deftest test-url-encode
  ;; privet
  (assert (string=
           (escaped-url-string-from-namestring "Привет")
           "%d0%9f%d1%80%d0%b8%d0%b2%d0%b5%d1%82"))

  ;; namasute
  (assert (string=
           (escaped-url-string-from-namestring "नमस्ते")
           "%e0%a4%a8%e0%a4%ae%e0%a4%b8%e0%a5%8d%e0%a4%a4%e0%a5%87"))

  ;; alphabet
  (assert (string=
           (escaped-url-string-from-namestring "abc123ABC :/.-_?=")
           "abc123ABC+:/.-_?="))

  (assert (string=
           "http://google.com/"
           (send (send (url-pathname "http://google.com/") :percent-escape) :string2)))

  (assert (string=
           (send (send (url-pathname "https://www.google.co.jp/?q=東大 ロボット") :percent-escape) :string2)
           "https://www.google.co.jp/?q=%e6%9d%b1%e5%a4%a7+%e3%83%ad%e3%83%9c%e3%83%83%e3%83%88"))
  (assert (string=
           (send (send (url-pathname "https://www.google.co.jp/?q=東大 ロボット") :percent-escape :queryp nil) :string2)
           "https://www.google.co.jp/?q=%e6%9d%b1%e5%a4%a7%20%e3%83%ad%e3%83%9c%e3%83%83%e3%83%88"))

  (assert (string=
           (send (send
                  (url-pathname
                   "https://www.google.co.jp/?q=%e6%9d%b1%e5%a4%a7%20%e3%83%ad%e3%83%9c%e3%83%83%e3%83%88")
                  :percent-escape :revert t :queryp nil) :string2)
           "https://www.google.co.jp/?q=東大 ロボット"))

  (assert (string=
           (send (send
                  (url-pathname
                   "https://www.google.co.jp/?q=%e6%9d%b1%e5%a4%a7+%e3%83%ad%e3%83%9c%e3%83%83%e3%83%88")
                  :percent-escape :revert t) :string2)
           "https://www.google.co.jp/?q=東大 ロボット"))

)

(eval-when (load eval)
  (run-all-tests)
  (exit))
; end of string.l