Skip to content

Commit

Permalink
Add tests for system types
Browse files Browse the repository at this point in the history
  • Loading branch information
robozmey committed Dec 16, 2024
1 parent 00895af commit c5907f6
Show file tree
Hide file tree
Showing 7 changed files with 1,575 additions and 70 deletions.
18 changes: 13 additions & 5 deletions contrib/try_convert/check_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,27 @@
'interval'

'regproc',
'pg_catalog',
'regclass',
'regtype',

'value_day',
'oid',
'jsonb',
'pg_catalog'
'reg_class'

# 'text',
# 'bpchar',
# 'varchar',
# 'char'
]

failed_tests = {}

for i in range(1, len(lines)):
preline = lines[i-1]
line = lines[i]
if len(line) > 0 and len(lines[i-1]) > 0 and line[0] == '-' and lines[i-1][0] != '-':
words = re.split('::|\*|;|\n| |\(|\)|,|\.|\".*\"|\'.*\'|<.*>', lines[i-1])
if len(line) > 0 and len(preline) > 0 and (line[0] == '-' or line[0] == '+') and (preline[0] != '-' and preline[0] != '+'):
words = re.split('::|\*|;|\n| |\(|\)|,|\.|\".*\"|\'.*\'|<.*>', preline)
ans = []
is_prining = False
for word in words:
Expand All @@ -50,5 +55,8 @@
if w in needed_types:
is_prining = True
if is_prining:
print(' '.join(ans))
failed_tests[' '.join(ans)] = True

for ft in failed_tests:
print(ft)

13 changes: 13 additions & 0 deletions contrib/try_convert/data/tt_oid.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
232
2908
1069
20
21
24
2950
701
18
19
114
1247
1259
12 changes: 12 additions & 0 deletions contrib/try_convert/data/tt_regclass.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pg_type
pg_proc
pg_class
pg_attribute
pg_user
pg_statistic
pg_class_oid_index
pg_views
pg_timezone_names
pg_stat_database
pg_tables
pg_roles
11 changes: 11 additions & 0 deletions contrib/try_convert/data/tt_regproc.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
textin
int4lt
float8abs
232
2908
now
pg_stat_get_activity
pg_table_size
1069
inet_client_addr
inet_server_addr
3 changes: 3 additions & 0 deletions contrib/try_convert/generate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
'uuid',

'regtype', # SYSTEM
'regproc',
'regclass',
'oid',

'citext',
]
Expand Down
330 changes: 327 additions & 3 deletions contrib/try_convert/input/try_convert.source

Large diffs are not rendered by default.

1,258 changes: 1,196 additions & 62 deletions contrib/try_convert/output/try_convert.source

Large diffs are not rendered by default.

0 comments on commit c5907f6

Please sign in to comment.