Index: openacs-4/packages/acs-tcl/tcl/test/text-html-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/text-html-procs.tcl,v diff -u -r1.11.2.13 -r1.11.2.14 --- openacs-4/packages/acs-tcl/tcl/test/text-html-procs.tcl 19 Mar 2024 10:44:57 -0000 1.11.2.13 +++ openacs-4/packages/acs-tcl/tcl/test/text-html-procs.tcl 8 Jul 2024 15:10:23 -0000 1.11.2.14 @@ -870,6 +870,83 @@ } +aa_register_case \ + -cats {api smoke production_safe} \ + -procs { + util_expand_entities + util_expand_entities_ie_style + } \ + util_expand_entities { + + Test if apis to expand certain entities work as expected. + + } { + + aa_section "util_expand_entities" + + foreach {input expected} { + {A text without any entity} + {A text without any entity} + + {A text with & entity} + {A text with & entity} + + {A text with & entity without semicolon} + {A text with & entity without semicolon} + + {A text with markup inside: Ciao Text} + {A text with markup inside: Ciao Text} + + {This test contains all supported entities: <, >, ", &, — and —} + {This test contains all supported entities: <, >, ", &, -- and --} + + {This test contains all supported entities without semicolon: <, >, &apmquot, &, &mdash and —} + {This test contains all supported entities without semicolon: <, >, &apmquot, &, &mdash and —} + } { + aa_equals [ns_quotehtml $input] [util_expand_entities $input] $expected + } + + aa_section "util_expand_entities_ie_style" + + foreach {input expected} { + {A text without any entity} + {A text without any entity} + + {A text with & entity} + {A text with & entity} + + {A text with & entity without semicolon} + {A text with & entity without semicolon} + + {A text with markup inside: Ciao Text} + {A text with markup inside: Ciao Text} + + {This test contains various supported entities by name: <, >, ", &, &ob; and &cb;} + "This test contains various supported entities by name: <, >, \", &, { and }" + + {This test contains various supported entities by number: <, >, ", & and —} + {This test contains various supported entities by number: <, >, ", & and —} + + {This test contains various supported entities by number with extra 0s: <, >, ", & and —} + {This test contains various supported entities by number with extra 0s: <, >, ", & and —} + + {This test contains various supported entities by hex: <, >, ", & and —} + {This test contains various supported entities by hex: <, >, ", & and —} + + {This test contains various supported entities by name without semicolon: <, >, ", &, &ob; and &cb;} + "This test contains various supported entities by name without semicolon: <, >, \", &, { and }" + + {This test contains various supported entities by number without semicolon: <, >, ", & and —} + {This test contains various supported entities by number without semicolon: <, >, ", & and —} + + {This test contains various supported entities by hex without semicolon: <, >, ", & and —} + {This test contains various supported entities by hex without semicolon: <, >, ", & and —} + } { + aa_equals [ns_quotehtml $input] [util_expand_entities_ie_style $input] $expected + } + + } + # Local variables: # mode: tcl # tcl-indent-level: 4