diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_naive_completion.py | 30 | ||||
-rw-r--r-- | tests/test_smart_completion_public_schema_only.py | 10 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_naive_completion.py b/tests/test_naive_completion.py index 7c7ed8e7..a6c80a7c 100644 --- a/tests/test_naive_completion.py +++ b/tests/test_naive_completion.py @@ -53,6 +53,12 @@ def test_function_name_completion(completer, complete_event): Completion(text="MATERIALIZED VIEW", start_position=-2), Completion(text="MAX", start_position=-2), Completion(text="MAXEXTENTS", start_position=-2), + Completion(text="MAKE_DATE", start_position=-2), + Completion(text="MAKE_TIME", start_position=-2), + Completion(text="MAKE_TIMESTAMPTZ", start_position=-2), + Completion(text="MAKE_INTERVAL", start_position=-2), + Completion(text="MASKLEN", start_position=-2), + Completion(text="MAKE_TIMESTAMP", start_position=-2), ] ) @@ -101,3 +107,27 @@ def test_special_name_completion(completer, complete_event): ) # Special commands will NOT be suggested during naive completion mode. assert result == completions_to_set([]) + + +def test_datatype_name_completion(completer, complete_event): + text = "SELECT price::IN" + position = len("SELECT price::IN") + result = completions_to_set( + completer.get_completions( + Document(text=text, cursor_position=position), + complete_event, + smart_completion=True, + ) + ) + assert result == completions_to_set( + [ + Completion(text="INET", display_meta="datatype"), + Completion(text="INT", display_meta="datatype"), + Completion(text="INT2", display_meta="datatype"), + Completion(text="INT4", display_meta="datatype"), + Completion(text="INT8", display_meta="datatype"), + Completion(text="INTEGER", display_meta="datatype"), + Completion(text="INTERNAL", display_meta="datatype"), + Completion(text="INTERVAL", display_meta="datatype"), + ] + ) diff --git a/tests/test_smart_completion_public_schema_only.py b/tests/test_smart_completion_public_schema_only.py index e046978b..b9357092 100644 --- a/tests/test_smart_completion_public_schema_only.py +++ b/tests/test_smart_completion_public_schema_only.py @@ -164,6 +164,12 @@ def test_builtin_function_name_completion(completer): result = get_result(completer, "SELECT MA") assert completions_to_set(result) == completions_to_set( [ + function("MAKE_DATE", -2), + function("MAKE_INTERVAL", -2), + function("MAKE_TIME", -2), + function("MAKE_TIMESTAMP", -2), + function("MAKE_TIMESTAMPTZ", -2), + function("MASKLEN", -2), function("MAX", -2), keyword("MAXEXTENTS", -2), keyword("MATERIALIZED VIEW", -2), @@ -189,6 +195,10 @@ def test_user_function_name_completion(completer): function("_custom_fun()", -2), function("custom_func1()", -2), function("custom_func2()", -2), + function("CURRENT_DATE", -2), + function("CURRENT_TIMESTAMP", -2), + function("CUME_DIST", -2), + function("CURRENT_TIME", -2), keyword("CURRENT", -2), ] ) |