Skip to content

Commit 92d4418

Browse files
committed
remove simple tests and backport unit tests from dev branch
1 parent d096ce3 commit 92d4418

Some content is hidden

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

59 files changed

+549
-4611
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11

22
.vscode/settings.json
33
node_modules
4+
test/tapigen_compiled_trigger

test/TEST_OM_TAPIGEN.pkb

Lines changed: 415 additions & 0 deletions
Large diffs are not rendered by default.

test/TEST_OM_TAPIGEN.pks

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
CREATE OR REPLACE PACKAGE test_om_tapigen IS
2+
-- Minimum needed DB version: 12.1
3+
-- Needed system priviliges: create procedure/sequence/table/trigger/view
4+
-- Run The Test As SQL Statement: select * from table(ut.run('test_om_tapigen'));
5+
--------------------------------------------------------------------------------
6+
7+
--%suite(OraMUC Table API Generator)
8+
--%rollback(manual)
9+
10+
--%beforeall
11+
procedure util_drop_and_create_test_table_objects;
12+
13+
--%beforeeach
14+
procedure util_drop_generated_objects;
15+
16+
--%test
17+
procedure test_all_tables_with_defaults;
18+
19+
--%test
20+
procedure test_all_tables_return_row_instead_of_pk_true;
21+
22+
--%test
23+
procedure test_table_users_create_methods_only;
24+
25+
--%test
26+
procedure test_table_users_update_methods_only;
27+
28+
--%test
29+
procedure test_table_users_delete_methods_only;
30+
31+
--%test
32+
procedure test_table_users_create_and_update_methods;
33+
34+
--------------------------------------------------------------------------------
35+
36+
subtype t_name is varchar2(128);
37+
38+
cursor cur_all_test_tables is
39+
select table_name
40+
from user_tables
41+
where table_name like 'TAG\_%' escape '\';
42+
43+
cursor cur_all_test_table_objects is
44+
select *
45+
from user_objects
46+
where object_type in ('TABLE', 'SEQUENCE')
47+
and object_name like 'TAG\_%' escape '\';
48+
49+
cursor cur_all_generated_objects is
50+
select *
51+
from user_objects
52+
where object_type in ('VIEW', 'PACKAGE')
53+
and object_name like 'TAG\_%' escape '\';
54+
55+
--------------------------------------------------------------------------------
56+
57+
procedure util_create_test_table_objects;
58+
59+
procedure util_drop_test_table_objects;
60+
61+
function util_count_generated_objects return integer;
62+
63+
function util_get_list_of_invalid_generated_objects return varchar2;
64+
65+
function util_get_test_name return varchar2;
66+
function util_get_spec_regex_count (
67+
p_code clob,
68+
p_regex_count varchar2
69+
) return integer;
70+
71+
function util_get_regex_substr_count (
72+
p_code clob,
73+
p_regex_substr varchar2,
74+
p_regex_count varchar2
75+
) return integer;
76+
77+
--------------------------------------------------------------------------------
78+
79+
END test_om_tapigen;
80+
/

test/compile_and_run_tests.sql

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--https://stackoverflow.com/questions/27543873/sqlplus-conditional-execution-with-variable-from-query
2+
set define on feedback off serveroutput on
3+
whenever sqlerror exit sql.sqlcode rollback
4+
5+
prompt
6+
prompt Test github.com/OraMUC/table-api-generator
7+
prompt ============================================================
8+
9+
prompt Create log table
10+
@create_log_table.sql
11+
12+
prompt Compile package test_om_tapigen (spec)
13+
@TEST_OM_TAPIGEN.pks
14+
show errors
15+
16+
prompt Compile package test_om_tapigen (body)
17+
@TEST_OM_TAPIGEN.pkb
18+
show errors
19+
20+
prompt RUN TESTS
21+
execute ut.run('test_om_tapigen');
22+
23+
prompt ============================================================
24+
prompt Tests Done
25+
prompt

test/create_log_table.sql

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--drop table, if it exists
2+
begin
3+
for i in (select table_name from user_tables where table_name = 'TEST_OM_TAPIGEN_LOG') loop
4+
execute immediate 'drop table ' || i.table_name;
5+
end loop;
6+
end;
7+
/
8+
9+
--create table
10+
create table test_om_tapigen_log (
11+
id integer generated always as identity,
12+
table_name varchar2(128 char) not null ,
13+
test_name varchar2(128 char) not null ,
14+
generated_code clob ,
15+
--
16+
primary key (id)
17+
);
18+
19+
--create table API - clearly, we use our table api generator for this ;-)
20+
begin
21+
om_tapigen.compile_api(
22+
p_table_name => 'TEST_OM_TAPIGEN_LOG',
23+
p_enable_update_of_rows => false,
24+
p_enable_proc_with_out_params => false,
25+
p_enable_getter_and_setter => false
26+
);
27+
end;
28+
/

test/simple/automatic-tests.bat

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/simple/automatic-tests.sql

Lines changed: 0 additions & 68 deletions
This file was deleted.

test/simple/create-objects-hr.bat

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)