Groonga-API
view release on metacpan or search on metacpan
t/10_basic.t view on Meta::CPAN
use strict;
use warnings;
use FindBin;
use File::Path;
use Test::More;
use Test::Differences;
use Ploonga;
my $tmpdir = "$FindBin::Bin/../tmp";
rmtree $tmpdir if -d $tmpdir;
mkpath $tmpdir;
my $ploonga = Ploonga->new(
dbfile => "$tmpdir/test.db",
);
# Try the official tutorial
# http://groonga.org/docs/tutorial/introduction.html
{
my $status = $ploonga->do('status');
ok $status, "status is not empty";
note explain $status;
}
{
my $rc = $ploonga->do('table_create --name Site --flags TABLE_HASH_KEY --key_type ShortText');
ok $rc, "created a table";
}
{
my $rows = $ploonga->do('select --table Site');
ok $rows, "select table";
eq_or_diff $rows => [
[
[
0
],
[
[
"_id",
"UInt32"
],
[
"_key",
"ShortText"
]
]
]
];
}
{
my $rc = $ploonga->do('column_create --table Site --name title --type ShortText');
ok $rc, "created a column";
}
{
my $rows = $ploonga->do('select --table Site');
ok $rows, "select table";
eq_or_diff $rows => [
[
[
0
],
[
( run in 0.522 second using v1.01-cache-2.11-cpan-39bf76dae61 )