diff --git a/analyzer/src/test/java/nl/basjes/parse/useragent/analyze/TestMatcherExpressions.java b/analyzer/src/test/java/nl/basjes/parse/useragent/analyze/TestMatcherExpressions.java index 64422947d7..36b5af5ab3 100644 --- a/analyzer/src/test/java/nl/basjes/parse/useragent/analyze/TestMatcherExpressions.java +++ b/analyzer/src/test/java/nl/basjes/parse/useragent/analyze/TestMatcherExpressions.java @@ -63,4 +63,11 @@ public void runAllFieldsTests() { UserAgentAnalyzerTester uaa = new UserAgentAnalyzerTester("classpath*:AllFields-tests.yaml"); Assert.assertTrue(uaa.runTests(false, true)); } + + @Test + public void runDebugOutputTest() { + UserAgentAnalyzerTester uaa = new UserAgentAnalyzerTester("classpath*:DebugOutput-tests.yaml"); + Assert.assertTrue(uaa.runTests(false, true)); + } + } diff --git a/analyzer/src/test/resources/DebugOutput-tests.yaml b/analyzer/src/test/resources/DebugOutput-tests.yaml new file mode 100644 index 0000000000..764525949a --- /dev/null +++ b/analyzer/src/test/resources/DebugOutput-tests.yaml @@ -0,0 +1,41 @@ +# +# Yet Another UserAgent Analyzer +# Copyright (C) 2013-2016 Niels Basjes +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an AS IS BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +config: +- lookup: + name: 'Dummy' + map: + "Nothing": "to see here" + +- matcher: + options: + - 'verbose' + require: + - 'LookUp[Dummy;agent.(1)product.(1)name;"Fake"]' + - 'IsNull[agent.(1)product.(1)name^.name="Word"!="Other"^.name[1]@{"Start"}"End"@@[-1][2-3][3-]<><]' + - 'IsNull[agent.(1)product.(1)name^.name="Bla"]' + extract: + - 'WordMatchFlipFlop: 1:agent.(1)product.(1)comments.(1-3)entry.(1)text[-1]="One"@[3]="Three"@[2]' + +- test: + options: + - 'verbose' + input: + name: 'Validate Debug Output looks good' + user_agent_string: 'Word/1 ( One Two Three )' + expected: + WordMatchFlipFlop: 'Two'