Browse Source

Merge pull request #2493 from negram/sa_body-regex

Sa body regex
pull/2497/head
Vsevolod Stakhov 7 years ago
committed by GitHub
parent
commit
b25488fe66
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      test/functional/cases/260_regex.robot
  2. 52
      test/functional/configs/regexp.conf

1
test/functional/cases/260_regex.robot

@ -22,6 +22,7 @@ Newlines
Check Rspamc ${result} SA_BODY_WORD_WITH_SPACE_BOUNDARIES
Check Rspamc ${result} SA_BODY_WORD_WITH_SPACE_BOUNDARIES_2
Check Rspamc ${result} SA_BODY_WORD_WITH_SPACE_BOUNDARIES_3
Check Rspamc ${result} SA_BODY_WORD_WITH_SPACE_AND_DOT
Check Rspamc ${result} https://google.com/maps/
Check Rspamc ${result} https://www.google.com/search?q\=hello world&oq\=hello world&aqs\=chrome..69i57j0l5.3045j0j7&sourceid\=chrome&ie\=UTF-8
Check Rspamc ${result} https://github.com/google/sanitizers/wiki/AddressSanitizer

52
test/functional/configs/regexp.conf

@ -0,0 +1,52 @@
regexp {
SA_BODY_WORD_BOUNDARY_ON_NEWLINE {
re = '/\\bhello\\s/{sa_body}',
score = 0.0,
description = 'Test if word boundary works correctly on sa_body regexes',
group = 'body',
}
SA_BODY_WORD {
re = '/hello/{sa_body}',
score = 0.0,
description = 'Test if regex works at all in sa_body',
group = 'body',
}
SA_BODY_WORD_WITH_NEWLINE {
re = '/helloworld/{sa_body}',
score = 0.0,
description = 'Test if regex matches word separated with newline (should not work!)',
group = 'body',
}
SA_BODY_WORD_WITH_SPACE {
re = '/hello world/{sa_body}',
score = 0.0,
description = 'Test if regex matches word separated with newline (should work - newline is replaced with space)',
group = 'body',
}
SA_BODY_WORD_WITH_SPACE_BOUNDARIES {
re = '/\\bhello world\\b/{sa_body}',
score = 0.0,
description = 'Test if regex matches word separated with newline (should work - newline is replaced with space)',
group = 'body',
}
SA_BODY_WORD_WITH_SPACE_BOUNDARIES_2 {
re = '/\\shello\\sworld\\s/{sa_body}',
score = 0.0,
description = 'Test if regex matches word separated with newline (should work - newline is replaced with space)',
group = 'body',
}
SA_BODY_WORD_WITH_SPACE_BOUNDARIES_3 {
re = '/\\shello\\sworld\\sthis\\s/{sa_body}',
score = 0.0,
description = 'Test if regex matches word separated with newline (should work - newline is replaced with space)',
group = 'body',
}
SA_BODY_WORD_WITH_SPACE_AND_DOT {
re = '/\\bword\\.\\sagain\\b/{sa_body}',
score = 0.0,
description = 'Test if regex matches word separated with newline (should work - newline is replaced with space)',
group = 'body',
}
}
lua = "${TESTDIR}/lua/regex_test.lua"
Loading…
Cancel
Save