libdoltlite-sys 0.38.21

Native bindings to the DoltLite SQLite-compatible library
Documentation
#
# 30-March-2022
#
#-------------------------------------------------------------------------
#

source [file join [file dirname [info script]] test_common.tcl]
set testprefix bcvfs_copy4

bcv_create_container cont1
for {set i 1} {$i<=23} {incr i} {
  bcv_upload_new_db cont1 t${i}.db {
    CREATE TABLE x1(x, y);
    INSERT INTO x1 VALUES('hello', 'world');
    INSERT INTO x1 VALUES('one', 'two');
  }
}

bcv_mkdir testdir

do_test 1.0 {
  set cmd [bcvfs_create testdir bcvfs]
  bcvfs_attach $cmd cont1
  $cmd destroy
} {}

do_test 1.1 {
  set cmd [bcvfs_create testdir bcvfs]
  $cmd poll cont1
  $cmd copy cont1 t12.db new.db
  $cmd destroy
} {}

do_test 1.2 {
  set cmd [bcvfs_create testdir bcvfs]
  $cmd poll cont1
  $cmd delete cont1 new.db
  $cmd destroy
} {}

do_test 1.3 {
  set cmd [bcvfs_create testdir bcvfs]
  $cmd poll cont1
  $cmd destroy
} {}

do_test 1.4 {
  set cmd [bcvfs_create testdir bcvfs]
  $cmd poll cont1
  $cmd copy cont1 t13.db xyz.db
  $cmd destroy
} {}


do_test 1.5 {
  set cmd [bcvfs_create testdir bcvfs]
  sqlite3 db /cont1/xyz.db -vfs bcvfs
  execsql {
    INSERT INTO x1 VALUES('a', 'b');
  }
  db close
  $cmd destroy
} {}

do_test 1.6 {
  set cmd [bcvfs_create testdir bcvfs]
  $cmd poll cont1
  $cmd upload cont1
  $cmd destroy
} {}


finish_test