Files
blockly/tests/generators/text.xml
2015-08-07 10:04:07 -07:00

708 lines
26 KiB
XML

<xml xmlns="http://www.w3.org/1999/xhtml">
<block type="unittest_main" x="-33" y="-11">
<statement name="DO">
<block type="procedures_callnoreturn">
<mutation name="test create text"></mutation>
<next>
<block type="procedures_callnoreturn">
<mutation name="test append item"></mutation>
<next>
<block type="procedures_callnoreturn">
<mutation name="test length"></mutation>
<next>
<block type="procedures_callnoreturn">
<mutation name="test empty"></mutation>
<next>
<block type="procedures_callnoreturn">
<mutation name="test substring"></mutation>
<next>
<block type="procedures_callnoreturn">
<mutation name="test find"></mutation>
<next>
<block type="procedures_callnoreturn">
<mutation name="test letter"></mutation>
<next>
<block type="procedures_callnoreturn">
<mutation name="test case"></mutation>
<next>
<block type="procedures_callnoreturn">
<mutation name="test trim"></mutation>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="261" y="3">
<field name="NAME">test length</field>
<statement name="STACK">
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">length</field>
<value name="ACTUAL">
<block type="text_length" inline="false">
<value name="VALUE">
<block type="text">
<field name="TEXT">Google</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="math_number">
<field name="NUM">6</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">length</field>
<value name="ACTUAL">
<block type="text_length" inline="false">
<value name="VALUE">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="math_number">
<field name="NUM">0</field>
</block>
</value>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="266" y="219">
<field name="NAME">test empty</field>
<statement name="STACK">
<block type="unittest_assertvalue" inline="false">
<field name="MESSAGE">not empty</field>
<field name="EXPECTED">FALSE</field>
<value name="ACTUAL">
<block type="text_isEmpty" inline="false">
<value name="VALUE">
<block type="text">
<field name="TEXT">Google</field>
</block>
</value>
</block>
</value>
<next>
<block type="unittest_assertvalue" inline="false">
<field name="MESSAGE">empty</field>
<field name="EXPECTED">TRUE</field>
<value name="ACTUAL">
<block type="text_isEmpty" inline="false">
<value name="VALUE">
<block type="text">
<field name="TEXT"></field>
</block>
</value>
</block>
</value>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="-21" y="342">
<field name="NAME">test create text</field>
<statement name="STACK">
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">single text</field>
<value name="ACTUAL">
<block type="text_join" inline="false">
<mutation items="1"></mutation>
<value name="ADD0">
<block type="text">
<field name="TEXT">Hello</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">Hello</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">double text</field>
<value name="ACTUAL">
<block type="text_join" inline="false">
<mutation items="2"></mutation>
<value name="ADD0">
<block type="text">
<field name="TEXT">K</field>
</block>
</value>
<value name="ADD1">
<block type="math_number">
<field name="NUM">9</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">K9</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">triple text</field>
<value name="ACTUAL">
<block type="text_join" inline="false">
<mutation items="3"></mutation>
<value name="ADD0">
<block type="math_number">
<field name="NUM">1</field>
</block>
</value>
<value name="ADD1">
<block type="math_number">
<field name="NUM">2</field>
</block>
</value>
<value name="ADD2">
<block type="math_number">
<field name="NUM">3</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">123</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="-23" y="733">
<field name="NAME">test append item</field>
<statement name="STACK">
<block type="variables_set" inline="false">
<field name="VAR">item</field>
<value name="VALUE">
<block type="text">
<field name="TEXT">Miserable</field>
</block>
</value>
<next>
<block type="text_append" inline="false">
<field name="VAR">item</field>
<value name="TEXT">
<block type="text">
<field name="TEXT">Failure</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">append text</field>
<value name="ACTUAL">
<block type="variables_get">
<field name="VAR">item</field>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">MiserableFailure</field>
</block>
</value>
<next>
<block type="variables_set" inline="false">
<field name="VAR">item</field>
<value name="VALUE">
<block type="math_number">
<field name="NUM">12</field>
</block>
</value>
<next>
<block type="text_append" inline="false">
<field name="VAR">item</field>
<value name="TEXT">
<block type="math_number">
<field name="NUM">34</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">append number</field>
<value name="ACTUAL">
<block type="variables_get">
<field name="VAR">item</field>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">1234</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="-24" y="1069">
<field name="NAME">test substring</field>
<statement name="STACK">
<block type="variables_set" inline="false">
<field name="VAR">text</field>
<value name="VALUE">
<block type="text">
<field name="TEXT">123456789</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">substring # start</field>
<value name="ACTUAL">
<block type="text_getSubstring">
<mutation at1="true" at2="true"></mutation>
<field name="WHERE1">FROM_START</field>
<field name="WHERE2">FROM_START</field>
<value name="STRING">
<block type="variables_get">
<field name="VAR">text</field>
</block>
</value>
<value name="AT1">
<block type="math_number">
<field name="NUM">2</field>
</block>
</value>
<value name="AT2">
<block type="math_number">
<field name="NUM">3</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">23</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">substring # end</field>
<value name="ACTUAL">
<block type="text_getSubstring">
<mutation at1="true" at2="true"></mutation>
<field name="WHERE1">FROM_END</field>
<field name="WHERE2">FROM_END</field>
<value name="STRING">
<block type="variables_get">
<field name="VAR">text</field>
</block>
</value>
<value name="AT1">
<block type="math_number">
<field name="NUM">3</field>
</block>
</value>
<value name="AT2">
<block type="math_number">
<field name="NUM">2</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">78</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">substring first-last</field>
<value name="ACTUAL">
<block type="text_getSubstring">
<mutation at1="false" at2="false"></mutation>
<field name="WHERE1">FIRST</field>
<field name="WHERE2">LAST</field>
<value name="STRING">
<block type="variables_get">
<field name="VAR">text</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="variables_get">
<field name="VAR">text</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="-24" y="1429">
<field name="NAME">test find</field>
<statement name="STACK">
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">first find</field>
<value name="ACTUAL">
<block type="text_indexOf">
<field name="END">FIRST</field>
<value name="VALUE">
<block type="text">
<field name="TEXT">Banana</field>
</block>
</value>
<value name="FIND">
<block type="text">
<field name="TEXT">an</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="math_number">
<field name="NUM">2</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">last find</field>
<value name="ACTUAL">
<block type="text_indexOf">
<field name="END">LAST</field>
<value name="VALUE">
<block type="text">
<field name="TEXT">Banana</field>
</block>
</value>
<value name="FIND">
<block type="text">
<field name="TEXT">an</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="math_number">
<field name="NUM">4</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">no find</field>
<value name="ACTUAL">
<block type="text_indexOf">
<field name="END">FIRST</field>
<value name="VALUE">
<block type="text">
<field name="TEXT">Banana</field>
</block>
</value>
<value name="FIND">
<block type="text">
<field name="TEXT">Peel</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="math_number">
<field name="NUM">0</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="-22" y="1789">
<field name="NAME">test letter</field>
<statement name="STACK">
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">letter #</field>
<value name="ACTUAL">
<block type="text_charAt">
<mutation at="true"></mutation>
<field name="WHERE">FROM_START</field>
<value name="VALUE">
<block type="text">
<field name="TEXT">Blockly</field>
</block>
</value>
<value name="AT">
<block type="math_number">
<field name="NUM">3</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">o</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">letter # from end</field>
<value name="ACTUAL">
<block type="text_charAt">
<mutation at="true"></mutation>
<field name="WHERE">FROM_END</field>
<value name="VALUE">
<block type="text">
<field name="TEXT">Blockly</field>
</block>
</value>
<value name="AT">
<block type="math_number">
<field name="NUM">3</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">k</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">first letter</field>
<value name="ACTUAL">
<block type="text_charAt">
<mutation at="false"></mutation>
<field name="WHERE">FIRST</field>
<value name="VALUE">
<block type="text">
<field name="TEXT">Blockly</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">B</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">last letter</field>
<value name="ACTUAL">
<block type="text_charAt">
<mutation at="false"></mutation>
<field name="WHERE">LAST</field>
<value name="VALUE">
<block type="text">
<field name="TEXT">Blockly</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">y</field>
</block>
</value>
<next>
<block type="unittest_assertvalue" inline="false">
<field name="MESSAGE">random letter</field>
<field name="EXPECTED">TRUE</field>
<value name="ACTUAL">
<block type="math_number_property">
<mutation divisor_input="false"></mutation>
<field name="PROPERTY">POSITIVE</field>
<value name="NUMBER_TO_CHECK">
<block type="text_indexOf" inline="false">
<field name="END">FIRST</field>
<value name="VALUE">
<block type="text">
<field name="TEXT">Blockly</field>
</block>
</value>
<value name="FIND">
<block type="text_charAt">
<mutation at="false"></mutation>
<field name="WHERE">RANDOM</field>
<value name="VALUE">
<block type="text">
<field name="TEXT">Blockly</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="-20" y="2295">
<field name="NAME">test case</field>
<statement name="STACK">
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">uppercase</field>
<value name="ACTUAL">
<block type="text_changeCase" inline="false">
<field name="CASE">UPPERCASE</field>
<value name="TEXT">
<block type="text">
<field name="TEXT">Hello World</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">HELLO WORLD</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">lowercase</field>
<value name="ACTUAL">
<block type="text_changeCase" inline="false">
<field name="CASE">LOWERCASE</field>
<value name="TEXT">
<block type="text">
<field name="TEXT">Hello World</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">hello world</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">titlecase</field>
<value name="ACTUAL">
<block type="text_changeCase" inline="false">
<field name="CASE">TITLECASE</field>
<value name="TEXT">
<block type="text">
<field name="TEXT">heLLo WorlD</field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">Hello World</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="-20" y="2598">
<field name="NAME">test trim</field>
<statement name="STACK">
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">trim both</field>
<value name="ACTUAL">
<block type="text_trim" inline="false">
<field name="MODE">BOTH</field>
<value name="TEXT">
<block type="text">
<field name="TEXT"> abc def </field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">abc def</field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">trim left</field>
<value name="ACTUAL">
<block type="text_trim" inline="false">
<field name="MODE">LEFT</field>
<value name="TEXT">
<block type="text">
<field name="TEXT"> abc def </field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT">abc def </field>
</block>
</value>
<next>
<block type="unittest_assertequals" inline="false">
<field name="MESSAGE">trim right</field>
<value name="ACTUAL">
<block type="text_trim" inline="false">
<field name="MODE">RIGHT</field>
<value name="TEXT">
<block type="text">
<field name="TEXT"> abc def </field>
</block>
</value>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<field name="TEXT"> abc def</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</xml>