xref: /sqlite-3.40.0/test/trace.test (revision b97759ed)
1# 2004 Jun 29
2#
3# The author disclaims copyright to this source code.  In place of
4# a legal notice, here is a blessing:
5#
6#    May you do good and not evil.
7#    May you find forgiveness for yourself and forgive others.
8#    May you share freely, never taking more than you give.
9#
10#***********************************************************************
11# This file implements regression tests for SQLite library.
12#
13# This file implements tests for the "sqlite3_trace()" API.
14#
15# $Id: trace.test,v 1.1 2004/06/29 11:26:59 drh Exp $
16
17set testdir [file dirname $argv0]
18source $testdir/tester.tcl
19
20do_test trace-1.1 {
21  set rc [catch {db trace 1 2 3} msg]
22  lappend rc $msg
23} {1 {wrong # args: should be "db trace ?CALLBACK?"}}
24proc trace_proc cmd {
25  lappend ::stmtlist [string trim $cmd]
26}
27do_test trace-1.2 {
28  db trace trace_proc
29  db trace
30} {trace_proc}
31do_test trace-1.3 {
32  execsql {
33    CREATE TABLE t1(a,b);
34    INSERT INTO t1 VALUES(1,2);
35    SELECT * FROM t1;
36  }
37} {1 2}
38do_test trace-1.4 {
39  set ::stmtlist
40} {{CREATE TABLE t1(a,b);} {INSERT INTO t1 VALUES(1,2);} {SELECT * FROM t1;} {}}
41do_test trace-1.5 {
42  db trace {}
43  db trace
44} {}
45
46finish_test
47