Skip to content

Commit 050c4a1

Browse files
pesseSamuel Nitsche
authored andcommitted
Fix problem with identifying annotations on windows machines when windows newline is used
1 parent e099d40 commit 050c4a1

3 files changed

Lines changed: 40 additions & 2 deletions

File tree

source/core/ut_annotations.pkb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ create or replace package body ut_annotations as
6868
l_comment := a_comments(l_comment_index);
6969

7070
-- strip everything except the annotation itself (spaces and others)
71-
l_annotation_str := regexp_substr(l_comment, c_annotation_pattern, 1, 1, modifier => 'i');
71+
l_annotation_str := regexp_substr(trim(translate(l_comment, chr(10)||chr(13), ' ')), c_annotation_pattern, 1, 1, modifier => 'i');
7272
if l_annotation_str is not null then
7373

7474
l_annotation_params.delete;

tests/RunAll.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ exec ut_coverage.coverage_start_develop();
4848
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParsePackageLevelAnnotationMultilineDeclare.sql
4949
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParsePackageLevelAnnotationWithKeyValue.sql
5050
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParsePackageLevelAnnotationWithMultilineComment.sql
51-
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.spaceBeforeAnnotationParams.sql
51+
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.spaceBeforeAnnotationParams.SQL
52+
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParseAnnotationWithWindowsNewline.sql
5253
@@lib/RunTest.sql ut_expectation_processor/who_called_expectation.parseStackTrace.sql
5354
@@lib/RunTest.sql ut_expectation_processor/who_called_expectation.parseStackTraceWith0x.sql
5455
@@ut_expectations/ut.expect.not_to_be_null.sql
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
PROMPT Parse package level annotations with windows newline
2+
3+
--Arrange
4+
declare
5+
l_source clob;
6+
l_parsing_result ut_annotations.typ_annotated_package;
7+
l_expected ut_annotations.typ_annotated_package;
8+
l_ann_param ut_annotations.typ_annotation_param;
9+
10+
begin
11+
l_source := 'PACKAGE test_tt AS
12+
-- %suite
13+
-- %displayname(Name of suite)' || chr(13) || chr(10)
14+
|| ' -- %suitepath(all.globaltests)
15+
END;';
16+
17+
--Act
18+
l_parsing_result := ut_annotations.parse_package_annotations(l_source);
19+
20+
--Assert
21+
l_ann_param := null;
22+
l_ann_param.val := 'Name of suite';
23+
l_expected.package_annotations('suite').params := cast( null as ut_annotations.tt_annotation_params);
24+
l_expected.package_annotations('displayname').params(1) := l_ann_param;
25+
26+
l_ann_param := null;
27+
l_ann_param.val := 'all.globaltests';
28+
l_expected.package_annotations('suitepath').params(1) := l_ann_param;
29+
30+
check_annotation_parsing(l_expected, l_parsing_result);
31+
32+
if ut_expectation_processor.get_status = ut_utils.tr_success then
33+
:test_result := ut_utils.tr_success;
34+
end if;
35+
36+
end;
37+
/

0 commit comments

Comments
 (0)