File: htmlreader.test

package info (click to toggle)
tdom 0.7.8-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,404 kB
  • ctags: 3,312
  • sloc: ansic: 38,842; xml: 18,244; tcl: 3,704; sh: 2,994; makefile: 58; cpp: 22
file content (41 lines) | stat: -rw-r--r-- 1,153 bytes parent folder | download | duplicates (2)
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
# Features covered: HTML parser
#
# This file contains a collection of tests for the HTML parser.
# Tested functionalities:
#    html-1.*: Character encoding
#
# Copyright (c) 2002 Rolf Ade.
#
# RCS: @(#) $Id: htmlreader.test,v 1.6 2002/11/16 01:31:37 rolf Exp $

source [file join [file dir [info script]] loadtdom.tcl]

test html-1.1 {HTML character entities} {need_i18n} {
    set doc [dom parse -html {<html><body>&nbsp;&iexcl;&Auml;&uuml;</body></html>}]
    set root [$doc documentElement]
    set body [$root firstChild]
    set result [$body text]
    $doc delete
    set result
} "\u00A0\u00A1\u00c4\u00fc"

test html-1.2 {character entities} {need_i18n} {
    set doc [dom parse -html {<html><body>&#214;&#xC4;&#xc4;</body></html>}]
    set root [$doc documentElement]
    set body [$root firstChild]
    set result [$body text]
    $doc delete
    set result
} "\u00d6\u00c4\u00c4"

test html-1.3 {character entities} {need_i18n} {
    set doc [dom parse -html {<html>&euro;&ni;</html>}]
    set root [$doc documentElement]
    set result [$root text]
    $doc delete
    set result
} "\u20ac\u220b"

# cleanup
::tcltest::cleanupTests
return