Skip to content

Commit 7d3dc18

Browse files
committed
test: smoke test of pgroonga with mecab
1 parent e704487 commit 7d3dc18

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
-- File: 0005-test_pgroonga_revised.sql
2+
3+
begin;
4+
-- Plan for 3 tests: extension, table, and index
5+
select plan(3);
6+
7+
-- Create the PGroonga extension
8+
create extension if not exists pgroonga;
9+
10+
-- -- Test 1: Check if PGroonga extension exists
11+
select has_extension('pgroonga', 'The pgroonga extension should exist.');
12+
13+
-- Create the table
14+
create table notes(
15+
id integer primary key,
16+
content text
17+
);
18+
19+
-- Test 2: Check if the table was created
20+
SELECT has_table('public', 'notes', 'The notes table should exist.');
21+
-- Create the PGroonga index
22+
CREATE INDEX pgroonga_content_index
23+
ON notes
24+
USING pgroonga (content)
25+
WITH (tokenizer='TokenMecab');
26+
27+
-- -- Test 3: Check if the index was created
28+
SELECT has_index('public', 'notes', 'pgroonga_content_index', 'The pgroonga_content_index should exist.');
29+
30+
-- -- Cleanup (this won't affect the test results as they've already been checked)
31+
DROP INDEX IF EXISTS pgroonga_content_index;
32+
DROP TABLE IF EXISTS notes;
33+
34+
-- Finish the test plan
35+
select * from finish();
36+
rollback;

0 commit comments

Comments
 (0)