webview

Check-in [62c9140a13]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Content generation tests
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 62c9140a139dd92d35a68104c15445342552e9b96b4d906348fc1a96860f5c7a
User & Date: murphy 2018-08-31 16:33:54
Context
2018-09-01
00:57
Corrected processing of callback errors check-in: 3134cb975d user: murphy tags: trunk
2018-08-31
16:33
Content generation tests check-in: 62c9140a13 user: murphy tags: trunk
14:42
Split content generation procedures into support module check-in: 082f8c0d5b user: murphy tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added tests/run.scm.











































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
;;
;; MIT License
;;
;; Copyright (c) 2018 Thomas Chust
;;
;; Permission is hereby granted, free of charge, to any person obtaining a copy
;; of this software and associated documentation files (the "Software"), to deal
;; in the Software without restriction, including without limitation the rights
;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
;; copies of the Software, and to permit persons to whom the Software is
;; furnished to do so, subject to the following conditions:
;;
;; The above copyright notice and this permission notice shall be included in
;; all copies or substantial portions of the Software.
;;
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
;; SOFTWARE.
;;

(require-library
  utf8 webview)
(import
  (only (chicken port) call-with-output-string)
  utf8-srfi-14
  webview-content test)

(define (js-escape s)
  (call-with-output-string
    (cut write-js s <> #f)))

(test-group "JavaScript strings"
  (test-assert (char-set-contains? char-set:no-js-escape #\+))
  (test-assert (char-set-contains? char-set:no-js-escape #\-))
  (test-assert (char-set-contains? char-set:no-js-escape #\space))
  (test-assert (char-set-contains? char-set:no-js-escape #\A))
  (test-assert (char-set-contains? char-set:no-js-escape #\B))
  (test-assert (char-set-contains? char-set:no-js-escape #\x30AB))
  (test-assert (not (char-set-contains? char-set:no-js-escape #\tab)))
  (test-assert (not (char-set-contains? char-set:no-js-escape #\newline)))
  (test-assert (not (char-set-contains? char-set:no-js-escape #\return)))
  (test-assert (not (char-set-contains? char-set:no-js-escape #\alarm)))
  (test "foo" (js-escape "foo"))
  (test "f\\\"o" (js-escape "f\"o"))
  (test "\\'o" (js-escape "'o"))
  (test "\\u0007foo\\nbar" (js-escape "\afoo\nbar"))
  (test "カタカナ\\u270d!" (js-escape "カタカナ✍!")))

(define (html->string html)
  (call-with-output-string
    (cut write-html html <>)))

(test-group "HTML content"
  (test 'normal (html-tag-rule 'p))
  (test 'raw (html-tag-rule 'script))
  (test 'void (html-tag-rule 'br))
  (test "<!DOCTYPE html>\n<html></html>\n" (html->string '(html)))
  (test "<br>" (html->string '(br)))
  (test "<p>Hello world!</p>" (html->string '(p "Hello world!")))
  (test "<span>&amp;</span>" (html->string '(span amp)))
  (test "<span>&#9997;</span>" (html->string '(span #x270d)))
  (test "<meta charset=\"utf-8\">" (html->string '(meta ([charset "utf-8"]))))
  (test "<span class=\"close\">blah &times;</span>" (html->string '(span ([class "close"]) "blah " times))))

;; vim: set ai et ts=4 sts=2 sw=2 ft=scheme: ;;

Changes to webview.egg.

5
6
7
8
9
10
11


12
13
14
15
16
17
18
19
20
21
22
 (version "1.0.0")
 (dependencies
   srfi-1
   srfi-13
   srfi-18
   srfi-69
   utf8)


 (components
   (extension webview
     (custom-build "build-webview")
     (source-dependencies
       "content.scm"
       "main.scm" "webview.h" "webview.impl.c")
     (modules
       webview-content
       webview))))

;; vim: set ai et ts=4 sts=2 sw=2 ft=scheme: ;;







>
>











5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 (version "1.0.0")
 (dependencies
   srfi-1
   srfi-13
   srfi-18
   srfi-69
   utf8)
 (test-dependencies
   test)
 (components
   (extension webview
     (custom-build "build-webview")
     (source-dependencies
       "content.scm"
       "main.scm" "webview.h" "webview.impl.c")
     (modules
       webview-content
       webview))))

;; vim: set ai et ts=4 sts=2 sw=2 ft=scheme: ;;