class
TEST_WIKI_TEXT
inherit
EQA_TEST_SET
TEST_WIKI_TEXT_I
undefine
default_create
end
feature -- Tests
test_1
local
t: WIKI_CONTENT_TEXT
o: STRING
do
create t.make_from_string ("[
[[Property:title|Breakpoint editing]]
[[Property:weight|1]]
[[Property:uuid|1ac830ab-7600-8e52-2351-c515bcc31d41]]
In all flat views ( [[Feature formatters: Flat view|feature flat view]] and [[Class formatters: Flat view|class flat view]] ), a margin is displayed on the left of the editor. [[Breakpoints|Breakpoints]] are symbolized there as circles, with different looks depending on their state: enabled ( [[Image:bp-enabled-icon]] ), disabled ( [[Image:bp-disabled-icon]] ) or not set ( [[Image:bp-slot-icon]] ). A small question mark in the circle ( [[Image:bp-enabled-conditional-icon]] , [[Image:bp-disabled-conditional-icon]] ) indicates [[Breakpoint menu|conditional breakpoints]] .
Right-clicking on any breakpoint pops up a context menu:
[[Image:breakpoint-context-menu]]
The first line provides the breakpoint slot index of the selected breakpoint (i.e: the one used in call stack or exception trace output).
Clicking one of the three first entries of the context menu changes the state of the breakpoint that was right-clicked. The last entry ('''Run to This Point''') launches the debugged application so that it will stop as soon as the selected breakpoint is encountered, as if the breakpoint had been enabled.
"Edit This Breakpoint" allows you to edit the parameters of the breakpoint (condition, hit count, when hits actions...) through the breakpoint dialog. On the first tab, '''Context''', the breakpoint dialog provides access to the associated tags, condition, and hit count control. And on the second tab, it allows you to associate '''When hits...''' action(s) with the breakpoint.
{|
|-
|
'''Context''' tab
[[Image:breakpoint-dialog-context|Context tab]]
|
'''When hits ...''' action tab
[[Image:breakpoint-dialog-when-hits-action|When hits... tab]]
|}
Tags allow you to identify a collection of breakpoints, either from the [[Breakpoint information command|breakpoints tool]] , or in the parameters of "When hits .." actions.
Any existing breakpoint can be referenced by an implicit tag with the form: ''"'''bp:'''cluster.{CLASS}.feature@index"'' (cluster is not mandatory).
{{sample|A sample breakpoint tag: "'''bp:'''elks.{LINKED_LIST}.extend@2"}}
* the "Condition" allows you to set a condition for stopping.
* the "Hit count" allows you to set a condition on hitcount for stopping.
* And the "When Hits..." allows you to associate specific actions with the breakpoint:
** Print message: display the expanded message to the output (there are predefined variables, and you can also evaluate expressions).
** Disable/Restore Assertion Checking: this might be useful to deactivate assertion checking on a specific part of the execution.
** Record Execution: start or stop the execution recording (cf: [[Execution record and replay|Execution recording and replay]] )
** Enable/Disable Breakpoints: either use tags or implicit tags (ex: ''"bp:elks.{LINKED_LIST}.extend@2"''), to reference a set of existing breakpoints. This can be pretty useful to enable a breakpoint only if the execution takes a specific execution path.
** Reset Hits count
"Edit Condition" allows you to set a condition for stopping, it opens the same dialog as "Edit This Breakpoint", but focus on the "condition" field.
[[Image:breakpoint-dialog-condition]]
"Hit count" allows you to set a condition on hitcount for stopping
[[Image:breakpoint-dialog-hit-count]]
"When hits ..." allows you to do an action when execution stops on this breakpoint. This can be `print message' for example.
[[Image:breakpoint-dialog-when-hits]]
{{seealso| [[Breakpoint commands|Breakpoint commands]], [[Breakpoint information command|Breakpoint information command]] }}
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", not o.is_empty)
end
test_toc_disabled
local
p: WIKI_PAGE
t: WIKI_CONTENT_TEXT
o: STRING
l_expected_output: STRING
do
create t.make_from_string ("{
begin
__NOTOC__
=One=
== one.1 ==
== one.2 ==
== one.3 ==
=Two=
== two.1 ==
== two.2 ==
=Three=
== three.1 ==
== three.2 ==
== three.3 ==
=And the last one=
== with spaces in text==
== summer:été==
end
}")
l_expected_output := "{
begin
One
one.1
one.2
one.3
Two
two.1
two.2
Three
three.1
three.2
three.3
And the last one
with spaces in text
summer:été
end
}"
create p.make_with_title ("Test TOC")
p.set_text (t)
create o.make_empty
p.process (new_xhtml_generator (o))
assert ("o", same_output (o, l_expected_output))
end
test_toc
local
p: WIKI_PAGE
t: WIKI_CONTENT_TEXT
o: STRING
l_expected_output: STRING
do
create t.make_from_string ("{
begin
__TOC__
=One=
== one.1 ==
== one.2 ==
== one.3 ==
=Two=
== two.1 ==
== two.2 ==
=Three=
== three.1 ==
== three.2 ==
== three.3 ==
end
}")
l_expected_output := "{
begin
One
one.1
one.2
one.3
Two
two.1
two.2
Three
three.1
three.2
three.3
end
}"
create p.make_with_title ("Test TOC")
p.set_text (t)
create o.make_empty
p.process (new_xhtml_generator (o))
assert ("o", same_output (o, l_expected_output))
end
test_toc_limited_depth
local
p: WIKI_PAGE
t: WIKI_CONTENT_TEXT
o: STRING
l_expected_output: STRING
do
create t.make_from_string ("{
begin
{{TOC|limit=2}}
=One=
== one.1 ==
=== one.1.1 ===
=== one.1.2 ===
== one.2 ==
== one.3 ==
=Two=
== two.1 ==
== two.2 ==
=Three=
== three.1 ==
== three.2 ==
=== three.2.1 ===
=== three.2.2 ===
== three.3 ==
end
}")
l_expected_output := "{
begin
One
one.1
one.1.1
one.1.2
one.2
one.3
Two
two.1
two.2
Three
three.1
three.2
three.2.1
three.2.2
three.3
end
}"
create p.make_with_title ("Test TOC")
p.set_text (t)
create o.make_empty
p.process (new_xhtml_generator (o))
assert ("o", same_output (o, l_expected_output))
end
test_anchor_name
local
o: STRING
vis: like new_xhtml_generator
do
create o.make_empty
vis := new_xhtml_generator (o)
assert ("valid anchor name", same_output (vis.anchor_name ("A text with spaces", True), "A_text_with_spaces"))
assert ("valid anchor name", same_output (vis.anchor_name ("unexpected # char", True), "unexpected_%%23_char"))
assert ("valid anchor name", same_output (vis.anchor_name ("summer=été", True), "summer=%%C3%%A9t%%C3%%A9"))
end
test_html
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
do
create t.make_from_string ("=test=%Ntoto
%Nend")
e := "[
test
toto
end
]"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", same_output (o, e))
end
test_paragraph
local
t: WIKI_CONTENT_TEXT
o: STRING
l_expected_output: STRING
do
create t.make_from_string ("[
This is a first line.
Then the second line.
Next paragraph, line 1.
line 2.
end.
]")
l_expected_output := "[
This is a first line.
Then the second line.
Next paragraph, line 1.
line 2.
end.
]"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", same_output (o, l_expected_output))
end
test_paragraph_with_cr
local
t: WIKI_CONTENT_TEXT
o: STRING
l_expected_output: STRING
do
create t.make_from_string ("This is a first line.%R%NThen the second line.%R%N%R%NNext paragraph, line 1.%R%Nline 2.%R%Nend.%R%N")
l_expected_output := "This is a first line.%R%NThen the second line.%R%N
%NNext paragraph, line 1.%R%Nline 2.%R%Nend.%R%N
%N"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", same_output (o, l_expected_output))
end
test_paragraph_in_section
local
t: WIKI_CONTENT_TEXT
o: STRING
l_expected_output: STRING
do
create t.make_from_string ("[
== Test ==
This is a first line.
Then the second line.
Next paragraph, line 1.
line 2.
end.
]")
l_expected_output := "[
Test
This is a first line.
Then the second line.
Next paragraph, line 1.
line 2.
end.
]"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", same_output (o, l_expected_output))
end
test_template
local
t: WIKI_CONTENT_TEXT
o: STRING
l_expected_output: STRING
do
create t.make_from_string ("[
==test==
{{seealso| [[Breakpoint commands|Breakpoint commands]], [[Breakpoint information command|Breakpoint information command]] }}
==end==
]")
l_expected_output := "[
test
Template#seealso
1= Breakpoint commands, Breakpoint information command
2={{{2}}}
3={{{3}}}
end
]"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", same_output (o, l_expected_output))
end
test_template_2
local
t: WIKI_CONTENT_TEXT
o: STRING
l_expected_output: STRING
do
create t.make_from_string ("[
==test==
{{seealso| [[Breakpoint commands|Breakpoint commands]] | [[Breakpoint information command|Breakpoint information command]] }}
==end==
]")
l_expected_output := "[
test
Template#seealso
1= Breakpoint commands
2= Breakpoint information command
3={{{3}}}
end
]"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", same_output (o, l_expected_output))
end
test_template_3_with_name
local
t: WIKI_CONTENT_TEXT
o: STRING
l_expected_output: STRING
do
create t.make_from_string ("[
==test==
{{Rule|name=foo|text=bar}}
==end==
]")
l_expected_output := "[
test
Template#Rule
name=foo
text=bar
end
]"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", same_output (o, l_expected_output))
end
test_template_with_unknown_name
local
t: WIKI_CONTENT_TEXT
o: STRING
l_expected_output: STRING
do
create t.make_from_string ("[
==test==
{{unknown| [[Breakpoint commands|Breakpoint commands]], [[Breakpoint information command|Breakpoint information command]] }}
==end==
]")
l_expected_output := "[
test
end
]"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", same_output (o, l_expected_output))
end
test_template_with_trailing_space
local
t: WIKI_CONTENT_TEXT
o: STRING
l_expected_output: STRING
do
create t.make_from_string ("[
==test==
{{SeeAlso | [[Breakpoint commands|Breakpoint commands]], [[Breakpoint information command|Breakpoint information command]] }}
==end==
]")
l_expected_output := "[
test
Template#SeeAlso
1= Breakpoint commands, Breakpoint information command
2={{{2}}}
3={{{3}}}
end
]"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", same_output (o, l_expected_output))
end
test_table
local
t: WIKI_CONTENT_TEXT
e,o: STRING
do
create t.make_from_string ("[
{| class="my-table"
|+ class="my-caption"|a table
|-
!style="text-align:left;"|Name
!Quantity
!Note
|-
|First
|10
|a comment
|-
|Second
|4
|another comment
|-
|Third
|1
|a last comment
|- class="total"
!Total
|15
|
|}
]")
e := "{
a table
Name | Quantity | Note |
First | 10 | a comment |
Second | 4 | another comment |
Third | 1 | a last comment |
Total | 15 | |
}"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", not o.is_empty)
assert ("expected", o.same_string (e))
end
test_table_inlined
local
t: WIKI_CONTENT_TEXT
e,o: STRING
do
create t.make_from_string ("[
{|
!Name!!Quantity!!Note
|-
|First||10||a comment
|-
|Second||4||another comment
|-
|Third||1||a last comment
|-
!Total||15!!...
|}
]")
e := "{
Name | Quantity | Note |
First | 10 | a comment |
Second | 4 | another comment |
Third | 1 | a last comment |
Total | 15 | ... |
}"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", not o.is_empty)
assert ("expected", o.same_string (e))
end
test_table_with_wiki_content
local
t: WIKI_CONTENT_TEXT
o: STRING
do
create t.make_from_string ("[
{|
|-
| '''Context''' tab
[[Image:breakpoint-dialog-context|Context tab]]
|
'''When hits ...''' action tab
[[Image:breakpoint-dialog-when-hits-action|When hits... tab]]
|}
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", not o.is_empty)
end
test_table_with_wiki_code_and_bang
local
t: WIKI_CONTENT_TEXT
o,e: STRING
do
create t.make_from_string ("[
{|
|-
| Test
|
bang-bang !! double exclamation marks
..
|}
]")
e := "[
Test |
bang-bang !! double exclamation marks
.. |
]"--
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", not o.is_empty)
assert ("expected", o.same_string (e))
create t.make_from_string ("[
{|
|-
| Test
|
bang-bang !! double exclamation marks
..
|}
]")
e := "[
Test |
bang-bang <em>!!</em> double exclamation marks
.. |
]"--
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", not o.is_empty)
assert ("expected", o.same_string (e))
create t.make_from_string ("[
{|
|-
| Test
|
```
bang-bang !! double exclamation marks
```..
|}
]")
e := "[
Test |
bang-bang !! double exclamation marks
.. |
]"--
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", not o.is_empty)
assert ("expected", o.same_string (e))
create t.make_from_string ("[
{|
|-
| Test
|
`bang-bang !! double exclamation marks`..
|}
]")
e := "[
Test |
bang-bang !! double exclamation marks .. |
]"--
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", not o.is_empty)
assert ("expected", o.same_string (e))
end
test_preformatted_text
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
do
create t.make_from_string ("{
begin
abc
def
ghi
end
}")
e := "{
begin
abc
def
ghi
end
}"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_code
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
do
create t.make_from_string ("[
class FOO [BAR]
feature
end
]")
e := "{
class FOO [BAR]
feature
end
}"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_code_2
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
do
create t.make_from_string ("[
The creation procedure
make (s, e: G)
takes ...
]")
e := "{
The creation procedure
make (s, e: G)
takes ...
}"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_html_code
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
do
create t.make_from_string ("[
bar
]")
e := "{
<foo>bar</foo>
}"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_code_with_brackets
local
t: WIKI_CONTENT_TEXT
o,e: STRING
do
create t.make_from_string ("[
class FOO
feature
do_call (a_procedure: separate PROCEDURE [ANY, TUPLE[separate STRING]]; a_string: separate STRING)
do
end
end
]")
e := "{
class FOO
feature
do_call (a_procedure: separate PROCEDURE [ANY, TUPLE[separate STRING]]; a_string: separate STRING)
do
end
end
}"
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", not o.is_empty)
end
test_nowiki
local
t: WIKI_CONTENT_TEXT
o: STRING
do
create t.make_from_string ("[
begin/
this is a ''test'' with link as [[Foobar|FooBar link]]
/end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("begin/%Nthis is a ''test'' with link as [[Foobar|FooBar link]]%N/end%N
%N"))
create t.make_from_string ("[
begin/
this is a ''test'' with multiple lines and links as [[Foobar|FooBar link]]
this is a ''test'' with multiple lines and links as [[Foobar|FooBar link]]
this is a ''test'' with multiple lines and links as [[Foobar|FooBar link]]
/end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("begin/%N%Nthis is a ''test'' with multiple lines and links as [[Foobar|FooBar link]]%Nthis is a ''test'' with multiple lines and links as [[Foobar|FooBar link]]%Nthis is a ''test'' with multiple lines and links as [[Foobar|FooBar link]]%N%N/end%N
%N"))
create t.make_from_string ("[
begin/
this is an inline foo.bar + test
/end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("begin/%Nthis is an inline <code>foo.bar + test</code>%N/end%N
%N"))
create t.make_from_string ("[
begin/
this is a block
class FOO
feature
end
/end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("begin/%Nthis is a block%N<code>%N class FOO%N feature%N end%N</code>%N%N/end%N
%N"))
create t.make_from_string ("[
begin/
this is a block
```
class FOO
feature
end
```
/end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("begin/%Nthis is a block%N```%N class FOO%N feature%N end%N```%N%N/end%N
%N"))
end
test_code_3backtiks
local
t: WIKI_CONTENT_TEXT
o: STRING
do
create t.make_from_string ("[
begin
```text
class FOO
feature
end
```
end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("begin%Nclass FOO%Nfeature%Nend
%N%Nend%N
%N"))
create t.make_from_string ("[
begin
```eiffel
class FOO
feature
end
```
end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("begin%Nclass FOO%Nfeature%Nend
%N%Nend%N
%N"))
create t.make_from_string ("[
begin
```eiffel
class FOO
feature
end
```
end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("begin%Nclass FOO <foo></bar>%Nfeature%Nend
%N%Nend%N
%N"))
create t.make_from_string ("[
begin
```xml
class FOOBAR
```
end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("begin%N<code lang=%"eiffel%">%N%Tclass FOOBAR%N</code>
%N%Nend%N
%N"))
end
test_code_single_backtik
local
t: WIKI_CONTENT_TEXT
o: STRING
do
create t.make_from_string ("[
begin `FOO.bar` end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("begin FOO.bar
end%N
%N"))
create t.make_from_string ("[
begin `FOO.bar and not ending backtick end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("begin `FOO.bar and not ending backtick end%N
%N"))
create t.make_from_string ("[
begin `foo qwe` end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("begin foo <bar> qwe
end%N
%N"))
create t.make_from_string ("[
begin `foo `
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("begin foo <bar>
%N
%N"))
end
test_code_single_backtik_with_lt_char
local
t: WIKI_CONTENT_TEXT
o: STRING
do
create t.make_from_string ("[
begin
`foobar` operations `<` or `>` or `<=>` `blabla` .
`foo bar`
end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("{
begin
foobar
operations <
or >
or <=>
blabla
.
foo bar
end
}"
)
)
end
test_code_single_backtik_escape
local
t: WIKI_CONTENT_TEXT
o: STRING
do
create t.make_from_string ("[
begin
Test \`abc' a\`n\`d.
end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("{
begin
Test `abc' a`n`d.
end
}")
)
create t.make_from_string ("[
begin
Test \`abc' and `\` and a\b\c.
end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("{
begin
Test `abc' and \
and a\b\c.
end
}")
)
end
test_code_double_backtik
local
t: WIKI_CONTENT_TEXT
o: STRING
do
create t.make_from_string ("[
begin `` `FOO.bar' `` end
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", o.same_string ("begin `FOO.bar'
end%N
%N"))
end
test_custom_code
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
class FOO [BAR]
feature
end
]")
e := "{
class FOO [BAR]
feature
end
}"
create o.make_empty
gen := new_xhtml_generator (o)
gen.code_aliases.force ("mycode")
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_list
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
'''List'''
* this
* is
* a
* list
* with
** sub item
** sub item
* end
]")
e := "{
List
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_list_number
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
'''Numbered lists'''
# list
# with
## sub item
## sub item
# end
]")
e := "{
Numbered lists
- list
- with
- sub item
- sub item
- end
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_list_definition
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
-- FIXME: does not support yet:
-- ; Term
-- : description line 1
-- : description line 2
--
-- or even with a single line.
create t.make_from_string ("[
'''Definitions'''
; abc: first letters
; pi: Pi number
; Term: description
]")
e := "{
Definitions
- abc
- first letters
- pi
- Pi number
- Term
- description
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_list_mixed
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
'''Mixed list'''
# Letters
#* a
#* b
#* c
# Misc
## sub item 1
##* bullet 1
##* bullet 2
## sub item 2
##* bullet 1
##** sub bullet 1.1
##* bullet 2
##*# sub item ..
# end
]")
e := "{
Mixed list
- Letters
- Misc
- sub item 1
- sub item 2
- end
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_tag_div
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
'''Test'''
'''class''' FOO [BAR]
feature
end
]")
e := "{
Test
class FOO [BAR]
feature
end
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_external_link
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
Test [https://eiffel.org Eiffel Community].
]")
e := "{
Test Eiffel Community.
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
create t.make_from_string ("[
Test [https://eiffel.org|Eiffel Community].
]")
e := "{
Test Eiffel Community.
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
create t.make_from_string ("[
Test [https://eiffel.org|target="blank"|foo=bar|Eiffel Community].
]")
e := "{
Test Eiffel Community.
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
create t.make_from_string ("[
Test [/path-to-page a page].
]")
e := "{
Test a page.
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_bracket_text_without_url
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
Test PROCEDURE [FOO] class.
]")
e := "{
Test PROCEDURE [FOO] class.
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_br
local
t: WIKI_CONTENT_TEXT
o: STRING
do
create t.make_from_string ("[
Tags allow you to identify a collection of breakpoints, either from the [[Breakpoint information command|breakpoints tool]] , or in the parameters of "When hits .." actions.
Any existing breakpoint can be referenced by an implicit tag with the form: ''"'''bp:'''cluster.{CLASS}.feature@index"'' (cluster is not mandatory).
{{sample|A sample breakpoint tag: "'''bp:'''elks.{LINKED_LIST}.extend@2"}}
]")
create o.make_empty
t.structure.process (new_xhtml_generator (o))
assert ("o", not o.is_empty)
end
test_anchor_link
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
test [[#anchor|anchor link]]
]")
e := "{
test anchor link
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_anchor_external_link
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
test [#Section_name Anchor to #Section_name]
]")
e := "{
test Anchor to #Section_name
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_anchor_section_link
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
* test [[#anchor|anchor link]]
* test [[#Another_anchor|Another anchor link]]
* test [[#another_anchor|Another anchor link]]
* test [[#Summer-été|Summer-été]]
== anchor ==
first test
== Another anchor ==
another
== Summer-été ==
Summer
]")
e := "{
anchor
first test
Another anchor
another
Summer-été
Summer
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_image
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
See [[Image:http://abs.path.to/image.png]]
]")
e := "{
See
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_image_inlined
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
See [[Image:http://abs.path.to/image.png|width=100px|This is a description|This is a title]]
]")
e := "{
See
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_image_details
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
See [[Image:http://abs.path.to/image.png|align=right|width=100px|This is a description]]
]")
e := "{
See

This is a description
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_image_details_with_alt
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
See [[Image:http://abs.path.to/image.png|align=right|width=100px|alt=Alternate text|This is a description]]
]")
e := "{
See

This is a description
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_image_details_with_frame
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
See [[Image:http://abs.path.to/image.png|align=right|frame|width=100px|alt=Alternate text|This is a description]]
]")
e := "{
See

This is a description
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_link
local
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
do
create t.make_from_string ("[
See [http://www.eiffel.org/ The Eiffel web site]
]")
e := "{
See The Eiffel web site
}"
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
end
test_unicode
local
txt,e32: STRING_32
t: WIKI_CONTENT_TEXT
o: STRING
e: STRING
gen: like new_xhtml_generator
utf: UTF_CONVERTER
do
txt := {STRING_32} "begin%N* Zhōng Fú 中孚 end"
create t.make_from_string (utf.utf_32_string_to_utf_8_string_8 (txt))
e32 := {STRING_32} "{
begin
}"
e := utf.utf_32_string_to_utf_8_string_8 (e32)
create o.make_empty
gen := new_xhtml_generator (o)
t.structure.process (gen)
assert ("o", not o.is_empty)
assert ("as e", o.same_string (e))
txt := utf.utf_8_string_8_to_string_32 (o)
assert ("as e32", txt.same_string (e32))
end
end