Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 06cb054

Browse files
committed
Revert "Comment out to see why its failing."
This reverts commit b5ad747. Revert "Adding validation for tag expression" This reverts commit 1478b0d.
1 parent b5ad747 commit 06cb054

5 files changed

Lines changed: 5 additions & 96 deletions

File tree

source/api/ut_runner.pkb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,14 @@ create or replace package body ut_runner is
9494

9595
ut_event_manager.trigger_event(ut_event_manager.gc_initialize);
9696
ut_event_manager.trigger_event(ut_event_manager.gc_debug, ut_run_info());
97-
97+
98+
--TODO:Verify tag tag expression is valid
9899
/*
99-
if ut_utils.valid_tag_expression(l_tags) = 0 then
100+
if regexp_like(l_tags,'[&|]{2,}|[!-]{2,}|[!-][&|]|[^-&|!,]+[-!]|[-!|&][)]')
101+
or (regexp_count(l_tags,'\(') <> regexp_count(l_tags,'\)')) then
100102
raise_application_error(ut_utils.gc_invalid_tag_expression, 'Invalid Tag expression');
101103
end if;
102104
*/
103-
104105
if a_random_test_order_seed is not null then
105106
l_random_test_order_seed := a_random_test_order_seed;
106107
elsif a_random_test_order then

source/core/ut_utils.pkb

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -988,68 +988,7 @@ create or replace package body ut_utils is
988988

989989
return l_result;
990990
end;
991-
992-
function valid_tag_expression(a_tags in varchar2) return number is
993-
t_left_side ut_varchar2_list := ut_varchar2_list('|','&',',');
994-
t_right_side ut_varchar2_list := ut_varchar2_list('!','-');
995-
l_left_side_expression varchar2(100) := '[|&,]';
996-
l_left_side_regex varchar(400) := '([^|&,]*)[|&,](.*)';
997-
l_left_side varchar2(4000);
998-
999-
l_rigth_side_expression varchar2(100) := '[!-]';
1000-
l_right_side_regex varchar(400) := '([!-])([^!-].*)';
1001-
l_right_side varchar2(4000);
1002-
1003-
l_tags varchar2(4000) := a_tags;
1004-
l_result number :=1;
1005-
begin
1006-
--Validate that we have closed up all brackets
1007-
if regexp_count(l_tags,'\(') <> regexp_count(l_tags,'\)') then
1008-
l_result := 0;
1009-
end if;
1010-
1011-
--Remove brackets as we dont evaluate expression only validate.
1012-
l_tags := replace(replace(l_tags,'('),')');
1013-
1014-
--Check if there are any left side operators for first in order from left to right
1015-
if regexp_count(l_tags,l_left_side_expression) > 0 then
1016-
--Extract left part of operator and remaining of string to right
1017-
l_left_side := regexp_replace(l_tags,l_left_side_regex,'\1');
1018-
l_right_side := regexp_replace(l_tags,l_left_side_regex,'\2');
1019-
1020-
--If left side is null that means that we used left side operator without
1021-
-- left and right e.g. &test
1022-
if l_left_side is null then
1023-
l_result := 0;
1024-
else
1025-
--Extract right side from left side expression if there is any !-
1026-
--Remove first negation tag to see if there is double negation
1027-
l_left_side := regexp_replace(l_left_side,l_right_side_regex,'\2');
1028-
end if;
1029-
1030-
1031-
--check that on right side there is no extra negation
1032-
if regexp_count(l_left_side,l_rigth_side_expression) > 0 then
1033-
l_result := 0;
1034-
end if;
1035-
1036-
--Now process right side of string
1037-
if l_right_side is not null then
1038-
l_result := least(l_result,valid_tag_expression(l_right_side));
1039-
else
1040-
l_result := 0;
1041-
end if;
1042-
else
1043-
--We just process single tag.
1044-
l_left_side := l_tags;
1045-
l_left_side := regexp_replace(l_left_side,l_right_side_regex,'\2');
1046-
if regexp_count(l_left_side,l_rigth_side_expression) > 0 then
1047-
l_result := 0;
1048-
end if;
1049-
end if;
1050-
1051-
return l_result;
1052-
end;
991+
1053992

1054993
end ut_utils;
1055994
/

source/core/ut_utils.pks

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,5 @@ create or replace package ut_utils authid definer is
477477
*/
478478
function interval_to_text(a_interval yminterval_unconstrained) return varchar2;
479479

480-
function valid_tag_expression(a_tags in varchar2) return number;
481-
482480
end ut_utils;
483481
/

test/ut3_tester/core/test_ut_utils.pkb

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -489,32 +489,5 @@ end;
489489
ut.expect(l_expected).to_equal(l_actual);
490490
end;
491491

492-
procedure valid_tag_expressions is
493-
begin
494-
ut.expect(1).to_equal(ut3_develop.ut_utils.valid_tag_expression('tag1'));
495-
ut.expect(1).to_equal(ut3_develop.ut_utils.valid_tag_expression('tag1|tag2'));
496-
ut.expect(1).to_equal(ut3_develop.ut_utils.valid_tag_expression('tag1&tag2'));
497-
ut.expect(1).to_equal(ut3_develop.ut_utils.valid_tag_expression('!tag1'));
498-
ut.expect(1).to_equal(ut3_develop.ut_utils.valid_tag_expression('tag1|!tag2'));
499-
ut.expect(1).to_equal(ut3_develop.ut_utils.valid_tag_expression('tag1&!tag2'));
500-
ut.expect(1).to_equal(ut3_develop.ut_utils.valid_tag_expression('!tag1|!tag2'));
501-
ut.expect(1).to_equal(ut3_develop.ut_utils.valid_tag_expression('!tag1&!tag2'));
502-
503-
ut.expect(1).to_equal(ut3_develop.ut_utils.valid_tag_expression('tag1,tag2'));
504-
ut.expect(1).to_equal(ut3_develop.ut_utils.valid_tag_expression('-tag1'));
505-
ut.expect(1).to_equal(ut3_develop.ut_utils.valid_tag_expression('tag1,-tag2'));
506-
ut.expect(1).to_equal(ut3_develop.ut_utils.valid_tag_expression('-tag1,-tag2'));
507-
508-
ut.expect(1).to_equal(ut3_develop.ut_utils.valid_tag_expression('(!tag1|!tag2)|tag3'));
509-
ut.expect(1).to_equal(ut3_develop.ut_utils.valid_tag_expression('(!tag1&!tag2)|(tag3&tag4)'));
510-
511-
ut.expect(0).to_equal(ut3_develop.ut_utils.valid_tag_expression('tag1|'));
512-
ut.expect(0).to_equal(ut3_develop.ut_utils.valid_tag_expression('&!tag2'));
513-
ut.expect(0).to_equal(ut3_develop.ut_utils.valid_tag_expression('!!tag1|!tag2'));
514-
ut.expect(0).to_equal(ut3_develop.ut_utils.valid_tag_expression('!tag1&!tag2|'));
515-
ut.expect(0).to_equal(ut3_develop.ut_utils.valid_tag_expression('((!tag1|!tag2)|tag3'));
516-
517-
end;
518-
519492
end test_ut_utils;
520493
/

test/ut3_tester/core/test_ut_utils.pks

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,6 @@ create or replace package test_ut_utils is
154154
--%test(returns text representation of interval year to month for custom interval)
155155
procedure int_conv_ym_date;
156156

157-
--%test(Test to validate different type of expressions passed as tags)
158-
procedure valid_tag_expressions;
159157

160158
--%endcontext
161159

0 commit comments

Comments
 (0)