Skip to content

Instantly share code, notes, and snippets.

@pjbriggs
Created May 8, 2015 13:38
Show Gist options
  • Save pjbriggs/5bfbcf22f72e0266e611 to your computer and use it in GitHub Desktop.
Save pjbriggs/5bfbcf22f72e0266e611 to your computer and use it in GitHub Desktop.
Demonstrate issue with "boolean" parameter type behaving differently in tests compared with interactive usage.
#!/bin/sh
echo Values are $1 $2 > $3
<tool id="boolean_issue" name="Boolean test issue" version="1.0">
<description>Demonstrate issue with booleans in Galaxy tests</description>
<command interpreter="bash">
boolean_test_issue.sh $bool_1 $bool_2 $output_1
</command>
<inputs>
<!-- Boolean with values without hyphen -->
<param name="bool_1" type="boolean"
truevalue="Yes" falsevalue="No" checked="True"
label="Test of boolean parameter" />
<!-- Boolean with values starting with hyphen -->
<param name="bool_2" type="boolean"
truevalue="-Yes" falsevalue="-No" checked="True"
label="Test of boolean parameter" />
</inputs>
<outputs>
<data name="output_1" format="txt" label="Values of booleans" />
</outputs>
<tests>
<test>
<!-- This test will fail: -Yes will not appear -->
<param name="bool_1" value="Yes" />
<param name="bool_2" value="-Yes" />
<output name="output_1">
<assert_contents>
<has_line line="Values are Yes -Yes" />
</assert_contents>
</output>
</test>
<test>
<!-- This test will pass -->
<param name="bool_1" value="No" />
<param name="bool_2" value="-No" />
<output name="output_1">
<assert_contents>
<has_line line="Values are No -No" />
</assert_contents>
</output>
</test>
<test>
<!-- This test will pass -->
<param name="bool_1" value="Yes" />
<param name="bool_2" value="-No" />
<output name="output_1">
<assert_contents>
<has_line line="Values are Yes -No" />
</assert_contents>
</output>
</test>
<test>
<!-- This test will fail: -Yes will not appear -->
<param name="bool_1" value="No" />
<param name="bool_2" value="-Yes" />
<output name="output_1">
<assert_contents>
<has_line line="Values are No -Yes" />
</assert_contents>
</output>
</test>
</tests>
</tool>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment