xref: /sqlite-3.40.0/test/trace.test (revision 93cd0395)
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.2 2004/06/30 02:35:51 danielk1977 Exp $
16
17set testdir [file dirname $argv0]
18source $testdir/tester.tcl
19
20set ::stmtlist {}
21do_test trace-1.1 {
22  set rc [catch {db trace 1 2 3} msg]
23  lappend rc $msg
24} {1 {wrong # args: should be "db trace ?CALLBACK?"}}
25proc trace_proc cmd {
26  lappend ::stmtlist [string trim $cmd]
27}
28do_test trace-1.2 {
29  db trace trace_proc
30  db trace
31} {trace_proc}
32do_test trace-1.3 {
33  execsql {
34    CREATE TABLE t1(a,b);
35    INSERT INTO t1 VALUES(1,2);
36    SELECT * FROM t1;
37  }
38} {1 2}
39do_test trace-1.4 {
40  set ::stmtlist
41} {{CREATE TABLE t1(a,b);} {INSERT INTO t1 VALUES(1,2);} {SELECT * FROM t1;} {}}
42do_test trace-1.5 {
43  db trace {}
44  db trace
45} {}
46
47finish_test
48