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

Skip to content

Commit 6717ad3

Browse files
committed
Add tests for Windows-style newlines and long procedure names in annotation parser
1 parent cc491cf commit 6717ad3

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

test/ut3_tester/core/annotations/test_annotation_parser.pkb

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,5 +859,65 @@ END;';
859859
ut.expect(l_result(1)).to_equal('v := ''a/b''; -- this is /* not */ a ml comment' || chr(10));
860860
end;
861861

862+
procedure test_windows_newline_lines
863+
as
864+
l_source dbms_preprocessor.source_lines_t;
865+
l_actual ut3_develop.ut_annotations;
866+
l_expected ut3_develop.ut_annotations;
867+
begin
868+
--Arrange
869+
l_source := make_source(ut_varchar2_list(
870+
'PACKAGE test_tt AS' || chr(10),
871+
' -- %suite' || chr(10),
872+
' -- %displayname(Name of suite)' || chr(13) || chr(10),
873+
' -- %suitepath(all.globaltests)' || chr(10),
874+
' END;' || chr(10)
875+
));
876+
877+
--Act
878+
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
879+
880+
--Assert
881+
l_expected := ut3_develop.ut_annotations(
882+
ut3_develop.ut_annotation( 2, 'suite', null, null ),
883+
ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
884+
ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null )
885+
);
886+
887+
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
888+
end;
889+
890+
procedure test_annot_very_long_name_lines
891+
as
892+
l_source dbms_preprocessor.source_lines_t;
893+
l_actual ut3_develop.ut_annotations;
894+
l_expected ut3_develop.ut_annotations;
895+
begin
896+
--Arrange
897+
l_source := make_source(ut_varchar2_list(
898+
'PACKAGE very_long_procedure_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_did_it AS' || chr(10),
899+
' -- %suite' || chr(10),
900+
' -- %displayname(Name of suite)' || chr(10),
901+
' -- %suitepath(all.globaltests)' || chr(10),
902+
'' || chr(10),
903+
' --%test' || chr(10),
904+
' procedure very_long_procedure_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_dit_it;' || chr(10),
905+
' END;' || chr(10)
906+
));
907+
908+
--Act
909+
l_actual := ut3_develop.ut_annotation_parser.parse_object_annotations(l_source, 'PACKAGE');
910+
911+
--Assert
912+
l_expected := ut3_develop.ut_annotations(
913+
ut3_develop.ut_annotation( 2, 'suite', null, null ),
914+
ut3_develop.ut_annotation( 3, 'displayname', 'Name of suite', null ),
915+
ut3_develop.ut_annotation( 4, 'suitepath', 'all.globaltests', null ),
916+
ut3_develop.ut_annotation( 6, 'test', null, 'very_long_procedure_name_valid_for_oracle_12_so_utPLSQL_should_allow_it_definitely_well_still_not_reached_128_but_wait_we_dit_it' )
917+
);
918+
919+
ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected));
920+
end;
921+
862922
end test_annotation_parser;
863923
/

test/ut3_tester/core/annotations/test_annotation_parser.pks

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ create or replace package test_annotation_parser is
6969
procedure test_rmc_multiple_ml_comments_one_line;
7070
-- %test(comment markers after string with slash handled correctly)
7171
procedure test_rmc_comment_after_string_with_slash;
72+
--%test(Parses source-code with Windows-style newline using source lines overload)
73+
procedure test_windows_newline_lines;
74+
--%test(parse annotations with very long procedure name using source lines overload)
75+
procedure test_annot_very_long_name_lines;
76+
7277

7378
end test_annotation_parser;
7479
/

0 commit comments

Comments
 (0)