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

Skip to content

Commit fd20062

Browse files
authored
Merge pull request #1 from jgebal/feature/new_matchers_and_data_types
Feature/new matchers and data types
2 parents 46add3e + ec81d30 commit fd20062

141 files changed

Lines changed: 3725 additions & 604 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis/create_utplsql_user.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ create user &ut3_user identified by &ut3_password default tablespace &ut3_tables
1313

1414
grant create session, create procedure, create type, create table to &ut3_user;
1515

16+
grant execute on dbms_pipe to &ut3_user;
17+
grant create job to &ut3_user;
18+
1619
grant alter session to &ut3_user;
1720

21+
--only needed to run unit tests for utplsql v3, not required to run utplsql v3 itself
22+
grant select any dictionary to &ut3_user;
23+
1824
exit success

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Changes are welcome from all members of the Community.
1515
* Create a new branch for your change.
1616
* Make your change in your new branch.
1717
* Although changes can be made in the master branch, it easier long term if a new branch is used.
18-
* **Verify code compiles and unit tests still pass.**
18+
* Make sure your change is covered with unit tests and/or is represented in examples
19+
* **Verify code compiles and all existing and new unit tests pass.**
1920
* The quickest way to have a Pull Request not be accepted, is to submit code that does not compile or pass tests.
2021
* Commit change to your local repository.
2122
* Push change to your remote repository

build/utplsql_style_check.sql

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
ALTER SESSION SET PLSCOPE_SETTINGS= 'IDENTIFIERS:ALL';
1+
alter session set plscope_settings= 'identifiers:all';
2+
set linesize 300
23

34
--install or comple all code here
45
exec dbms_utility.compile_schema(USER,compile_all => TRUE,reuse_settings => FALSE);
@@ -12,39 +13,44 @@ column errcnt_c noprint new_value errcnt_c
1213

1314
--find parameters that donot begin with A_
1415
prompt parameters should start with A_
15-
select NAME,TYPE,OBJECT_NAME,OBJECT_TYPE,USAGE,LINE,COL , count(*) over() errcnt_a
16-
from user_identifiers
17-
where type like 'FORMAL%' and usage = 'DECLARATION'
18-
and name != 'SELF'
19-
and name not like 'A#_%' escape '#'
20-
order by object_name, object_type, line, col
16+
select name, type, object_name, object_type, usage, line, col, count(*) over() errcnt_a
17+
from user_identifiers
18+
where type like 'FORMAL%' and usage = 'DECLARATION'
19+
and name != 'SELF'
20+
and name not like 'A#_%' escape '#'
21+
order by object_name, object_type, line, col
2122
;
2223

2324
prompt variables should start with L_
2425
--variables start with l_ or g_
25-
select NAME,TYPE,OBJECT_NAME,OBJECT_TYPE,USAGE,LINE,COL , count(*) over() errcnt_l
26-
from user_identifiers
27-
where type like 'VARIABLE' and usage = 'DECLARATION'
28-
and object_type not in ('TYPE')
29-
and (name not like 'L#_%' escape '#'
30-
and name not like 'G#_%' escape '#' --TODO: only valid on package level
31-
)
32-
order by object_name, object_type, line, col
26+
select i.name, i.type, i.object_name, i.object_type, i.usage, i.line, i.col, count(*) over() errcnt_l
27+
from user_identifiers i
28+
join user_identifiers p
29+
on p.object_name = i.object_name and p.object_type = i.object_type
30+
and i.usage_context_id = p.usage_id
31+
where i.type like 'VARIABLE' and i.usage = 'DECLARATION'
32+
and i.object_type not in ('TYPE')
33+
and (i.name not like 'L#_%' escape '#' and p.type in ('PROCEDURE','FUNCTION','ITERATOR')
34+
or i.name not like 'G#_%' escape '#' and p.type not in ('PROCEDURE','FUNCTION','ITERATOR'))
35+
and p.type != 'RECORD'
36+
order by object_name, object_type, line, col;
3337
;
3438

3539
--constants start with c_ or gc_
3640
prompt constants should start with C_
37-
select NAME,TYPE,OBJECT_NAME,OBJECT_TYPE,USAGE,LINE,COL , count(*) over() errcnt_c
38-
from user_identifiers
39-
where type like 'CONSTANT' and usage = 'DECLARATION'
40-
and (name not like 'C#_%' escape '#'
41-
and name not like 'GC#_%' escape '#'
42-
)
43-
order by object_name, object_type, line, col
41+
select i.name, i.type, i.object_name, i.object_type, i.usage, i.line, i.col, count(*) over() errcnt_c
42+
from user_identifiers i
43+
join user_identifiers p
44+
on p.object_name = i.object_name and p.object_type = i.object_type
45+
and i.usage_context_id = p.usage_id
46+
where i.type like 'CONSTANT' and i.usage = 'DECLARATION'
47+
and (i.name not like 'C#_%' escape '#' and p.type in ('PROCEDURE','FUNCTION','ITERATOR')
48+
or i.name not like 'GC#_%' escape '#' and p.type not in ('PROCEDURE','FUNCTION','ITERATOR'))
49+
order by object_name, object_type, line, col
4450
;
4551

4652

4753
exec :errcnt := nvl('&errcnt_a',0) + nvl('&errcnt_l',0) + nvl('&errcnt_c',0);
4854

4955
--quit :errcnt
50-
exit success
56+
exit success

examples/RunAllExamples.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
PROMPT Run all examples
12
Clear Screen
23
set echo off
34
set feedback off
@@ -20,3 +21,9 @@ prompt RunExampleTestAnnotationsHugePackage
2021
@@RunExampleTestAnnotationsHugePackage.sql
2122
prompt RunExpectations
2223
@@RunExpectations.sql
24+
25+
@@RunWithDocumentationReporter.sql
26+
27+
@@award_bonus/run_award_bonus_test.sql
28+
@@between_string/run_betwnstr_test.sql
29+
@@remove_rooms_by_name/run_remove_rooms_by_name_test.sql

examples/RunExampleComplexSuiteWithCustomDBMSOutputReporter.sql

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,31 @@ declare
1717
suite2 ut_test_suite;
1818
suite_complex ut_test_suite;
1919
testtoexecute ut_test;
20+
reporter ut_reporter;
2021
begin
21-
suite1 := ut_test_suite(a_suite_name => 'Test Suite 1' /*,a_items => ut_test_objects_list()*/);
22+
suite1 := ut_test_suite(a_suite_name => 'Test Suite 1', a_object_name => null /*,a_items => ut_test_objects_list()*/);
2223

2324
testtoexecute := ut_test(a_object_name => 'ut_exampletest'
2425
,a_test_procedure => 'ut_exAmpletest'
25-
,a_test_name => 'Example test1'
26+
,a_test_name => 'Example test1'
2627
,a_setup_procedure => 'Setup'
2728
,a_teardown_procedure => 'tEardown');
2829

2930
suite1.add_item(testtoexecute);
3031

31-
suite2 := ut_test_suite(a_suite_name => 'Test Suite 2' /*,a_items => ut_test_objects_list()*/);
32+
suite2 := ut_test_suite(a_suite_name => 'Test Suite 2', a_object_name => null /*,a_items => ut_test_objects_list()*/);
3233
testtoexecute := ut_test(a_object_name => 'UT_EXAMPLETEST2'
3334
,a_test_procedure => 'UT_EXAMPLETEST'
3435
,a_setup_procedure => 'SETUP'
3536
,a_teardown_procedure => 'TEARDOWN');
3637

3738
suite2.add_item(testtoexecute);
3839

39-
suite_complex := ut_test_suite(a_suite_name => 'Complex Test Suite', a_items => ut_objects_list(suite1, suite2));
40+
suite_complex := ut_test_suite(a_suite_name => 'Complex Test Suite', a_object_name => null, a_items => ut_objects_list(suite1, suite2));
4041

4142
-- provide a reporter to process results
42-
suite_complex.do_execute(ut_custom_reporter(a_tab_size => 2));
43+
reporter := ut_custom_reporter(a_tab_size => 2);
44+
suite_complex.do_execute(reporter);
4345
end;
4446
/
4547

examples/RunExampleTestAnnotationBasedForCurrentSchema.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ set echo off
1010
@@ut_custom_reporter.tps
1111
@@ut_custom_reporter.tpb
1212

13-
begin
14-
ut_suite_manager.run_cur_schema_suites_static(ut_custom_reporter(a_tab_size => 2));
13+
begin
14+
ut.run(user, ut_custom_reporter(a_tab_size => 2));
1515
end;
1616
/
1717

examples/RunExampleTestSuite.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ declare
1616
test_item ut_test;
1717
assert ut_assert_result;
1818
begin
19-
suite := ut_test_suite(a_suite_name => 'Test Suite Name' /*,a_items => ut_test_objects_list()*/);
19+
suite := ut_test_suite(a_suite_name => 'Test Suite Name', a_object_name => 'ut_exampletest' /*,a_items => ut_test_objects_list()*/);
2020

2121
testtoexecute := ut_test(a_object_name => 'ut_exampletest'
2222
,a_test_procedure => 'ut_exAmpletest'

examples/RunExampleTestSuiteWithCompositeReporter.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ PROMPT Runs test report using composite reporter
1414
declare
1515
suite ut_test_suite;
1616
testtoexecute ut_test;
17+
reporter ut_reporter;
1718
begin
18-
suite := ut_test_suite(a_suite_name => 'Test Suite Name' /*,a_items => ut_test_objects_list()*/);
19+
suite := ut_test_suite(a_suite_name => 'Test Suite Name', a_object_name => 'ut_exampletest' /*,a_items => ut_test_objects_list()*/);
1920

2021
testtoexecute := ut_test(a_object_name => 'ut_exampletest'
2122
,a_test_procedure => 'ut_exAmpletest'
@@ -32,7 +33,8 @@ begin
3233
suite.add_item(testtoexecute);
3334

3435
-- provide a reporter to process results
35-
suite.do_execute(ut_composite_reporter(ut_reporters_list(ut_dbms_output_suite_reporter)));
36+
reporter := ut_composite_reporter(ut_reporters_list(ut_documentation_reporter, ut_teamcity_reporter));
37+
suite.do_execute(reporter);
3638
end;
3739
/
3840

examples/RunExampleTestSuiteWithCustomDBMSOutputReporter.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ set echo off
1616
declare
1717
suite ut_test_suite;
1818
testtoexecute ut_test;
19+
reporter ut_reporter;
1920
begin
2021
-- Install ut_custom_reporter first from example folder
2122

22-
suite := ut_test_suite(a_suite_name => 'Test Suite Name' /*,a_items => ut_test_objects_list()*/);
23+
suite := ut_test_suite(a_suite_name => 'Test Suite Name', a_object_name => 'ut_exampletest' /*,a_items => ut_test_objects_list()*/);
2324

2425
testtoexecute := ut_test(a_object_name => 'ut_exampletest'
2526
,a_test_procedure => 'ut_exAmpletest'
@@ -36,7 +37,8 @@ begin
3637
suite.add_item(testtoexecute);
3738

3839
-- provide a reporter to process results tabbing each hierarcy level by tab_size
39-
suite.do_execute(ut_custom_reporter(a_tab_size => 2));
40+
reporter := ut_custom_reporter(a_tab_size => 2);
41+
suite.do_execute(reporter);
4042
end;
4143
/
4244

examples/RunExampleTestSuiteWithDBMSOutputReporter.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ set echo off
1313
declare
1414
suite ut_test_suite;
1515
testtoexecute ut_test;
16+
reporter ut_reporter;
1617
begin
17-
suite := ut_test_suite(a_suite_name => 'Test Suite Name' /*,a_items => ut_test_objects_list()*/);
18+
suite := ut_test_suite(a_suite_name => 'Test Suite Name', a_object_name => 'ut_exampletest' /*,a_items => ut_test_objects_list()*/);
1819

1920
testtoexecute := ut_test(a_object_name => 'ut_exampletest'
2021
,a_test_procedure => 'ut_exAmpletest'
@@ -31,7 +32,8 @@ begin
3132
suite.add_item(testtoexecute);
3233

3334
-- provide a reporter to process results
34-
suite.do_execute(ut_dbms_output_suite_reporter);
35+
reporter := ut_documentation_reporter;
36+
suite.do_execute(reporter);
3537
end;
3638
/
3739

0 commit comments

Comments
 (0)