Skip to content

Commit

Permalink
Merge pull request #15483 from bernt-matthias/tests-fix
Browse files Browse the repository at this point in the history
Fixes for two framework test tools
  • Loading branch information
mvdbeek committed Jun 21, 2023
2 parents 8b6f11c + 8fba3bf commit 71d70a9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 39 deletions.
2 changes: 1 addition & 1 deletion lib/galaxy/tool_util/xsd/galaxy.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -4986,7 +4986,7 @@ only used if ``multiple`` is set to ``true``.]]></xs:documentation>
<xs:annotation>
<xs:documentation xml:lang="en">If ``true``, keep columns matching the
value, if ``false`` discard columns matching the value. Used when ``type`` is
either ``static_value``, ``regexp`` or ``param_value``.</xs:documentation>
either ``static_value``, ``regexp`` or ``param_value``. Default: true</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="value" type="xs:string">
Expand Down
2 changes: 1 addition & 1 deletion test/functional/tools/expression_pick_larger_file.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</test>
<test>
<param name="input1" value_json="null" />
<param name="input2" value_json="simple_line.txt" />
<param name="input2" value_json="&quot;simple_line.txt&quot;" />
<output name="larger_file" file="simple_line.txt"/>
</test>
</tests>
Expand Down
77 changes: 40 additions & 37 deletions test/functional/tools/filter_static_regexp.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,46 @@
<tool id="filter_static_regexp" name="filter_static_regexp" version="0.1.0">
<description>Filter by static value and regexp</description>
<command><![CDATA[
echo $index_static > '$output' &&
echo $index_static_keep >> '$output' &&
echo $index_regexp >> '$output' &&
echo $index_regexp_keep >> '$output' &&
#if $index_static
echo index_static $index_static > '$output' &&
#end if
#if $index_static_keep
echo index_static_keep $index_static_keep >> '$output' &&
#end if
#if $index_regexp
echo index_regexp $index_regexp >> '$output' &&
#end if
#if $index_regexp_keep
echo index_regexp_keep $index_regexp_keep >> '$output'
#end if
]]></command>
<inputs>
<!-- tests for static_value filter: remove hp18 from the options by
a) removing it explicitly (due to keep="false")
b) keeping only the other option, i.e. hg19 -->
<param name="index" type="select" label="Using reference genome">
<param name="index_static" type="select" optional="true" label="Using reference genome">
<options from_data_table="test_fasta_indexes">
<filter type="static_value" column="dbkey" value="hg18" />
<validator type="no_options" message="No reference genome is available for the build associated with the selected input dataset" />
</options>
</param>
<param name="index2" type="select" label="Using reference genome">
<param name="index_static_keep" type="select" optional="true" label="Using reference genome">
<options from_data_table="test_fasta_indexes">
<filter type="static_value" column="dbkey" value="hg19" keep="true" />
<filter type="static_value" column="dbkey" value="hg18" keep="false" />
<validator type="no_options" message="No reference genome is available for the build associated with the selected input dataset" />
</options>
</param>
<!-- tests for regexp filter: remove hp18 from the options
essentially the same as for the static value filter, just using a simple regexp -->
<param name="index_regexp" type="select" label="Using reference genome">
<param name="index_regexp" type="select" optional="true" label="Using reference genome">
<options from_data_table="test_fasta_indexes">
<filter type="regexp" column="dbkey" value="hg.8" />
<validator type="no_options" message="No reference genome is available for the build associated with the selected input dataset" />
</options>
</param>
<param name="index_regexp_keep" type="select" label="Using reference genome">
<param name="index_regexp_keep" type="select" optional="true" label="Using reference genome">
<options from_data_table="test_fasta_indexes">
<filter type="regexp" column="dbkey" value="hg.9" keep="true" />
<filter type="regexp" column="dbkey" value="hg.8" keep="false" />
<validator type="no_options" message="No reference genome is available for the build associated with the selected input dataset" />
</options>
</param>
Expand All @@ -43,49 +51,44 @@ echo $index_regexp_keep >> '$output' &&
</outputs>

<tests>
<!-- can choose a dbkey if it matches input -->
<!-- check that non filtered values can be chosen -->
<test>
<param name="index_static" value="hg19_value" />
<param name="index_static" value="hg18_value" />
<param name="index_static_keep" value="hg19_value" />
<param name="index_regexp" value="hg19_value" />
<param name="index_regexp" value="hg18_value" />
<param name="index_regexp_keep" value="hg19_value" />
<output name="output">
<assert_contents>
<has_text text="hg19" />
<not_has_text text="hg18" />
<has_text text="index_static hg18_value" />
<has_text text="index_static_keep hg19_value" />
<has_text text="index_regexp hg18_value" />
<has_text text="index_regexp_keep hg19_value" />
</assert_contents>
</output>
</test>
<!-- cannot pick index otherwise -->
<!-- Does this make sense - if no dbkey is defined there is no option
available? -->
<test expect_failure="true">
<param name="index_static" value="hg18_value" />
<param name="index_static_keep" value="hg19_value" />
<param name="index_regexp" value="hg19_value" />
<param name="index_regexp_keep" value="hg19_value" />
<output name="output"/>
<!-- ... all of them -->
<test>
<param name="index_static_keep" value="mm10_value" />
<param name="index_regexp_keep" value="mm10_value" />
<output name="output">
<assert_contents>
<has_text text="index_static_keep mm10_value" />
<has_text text="index_regexp_keep mm10_value" />
</assert_contents>
</output>
</test>
<!-- cannot pick filtered options -->
<test expect_failure="true">
<param name="index_static" value="hg19_value" />
</test>
<test expect_failure="true">
<param name="index_static_keep" value="hg18_value" />
<param name="index_regexp" value="hg19_value" />
<param name="index_regexp_keep" value="hg19_value" />
<output name="output"/>
</test>
<test expect_failure="true">
<param name="index_static" value="hg19_value" />
<param name="index_static_keep" value="hg19_value" />
<param name="index_regexp" value="hg18_value" />
<param name="index_regexp_keep" value="hg19_value" />
<output name="output"/>
<param name="index_regexp" value="hg19_value" />
</test>
<test expect_failure="true">
<param name="index_static" value="hg19" />
<param name="index_static_keep" value="hg19" />
<param name="index_regexp" value="hg19" />
<param name="index_regexp_keep" value="hg18" />
<output name="output"/>
<param name="index_regexp_keep" value="hg18_value" />
</test>
</tests>
<help>
Expand Down

0 comments on commit 71d70a9

Please sign in to comment.