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

Skip to content

Commit b236bf7

Browse files
authored
Merge pull request #435 from pesse/fix_newline_in_annotations
Fix problem with identifying annotations when windows newline is used
2 parents 2592bc5 + 061cdf3 commit b236bf7

3 files changed

Lines changed: 39 additions & 1 deletion

File tree

source/core/ut_metadata.pkb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ create or replace package body ut_metadata as
128128
-- we fetch the source explicitly as dbms_preprocessor is very sow on 12.1 and 12.2 when grabbing the sources.
129129
l_lines := sys.dbms_preprocessor.get_post_processed_source(l_lines);
130130
for i in 1..l_lines.count loop
131-
ut_utils.append_to_clob(l_source, l_lines(i));
131+
ut_utils.append_to_clob(l_source, replace(l_lines(i), chr(13)||chr(10), chr(10)));
132132
end loop;
133133
return l_source;
134134
end;

tests/RunAll.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ exec ut_coverage.coverage_start_develop();
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
5151
@@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)