xref: /sqlite-3.40.0/test/withM.test (revision 4e9119d9)
1# 2014 January 11
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.  The
12# focus of this file is testing the WITH clause.
13#
14
15set testdir [file dirname $argv0]
16source $testdir/tester.tcl
17source $testdir/malloc_common.tcl
18set ::testprefix withM
19
20do_execsql_test 1.0 {
21  CREATE TABLE t1(x INTEGER, y INTEGER);
22  INSERT INTO t1 VALUES(123, 456);
23}
24
25do_faultsim_test withM-1 -prep {
26  sqlite3 db test.db
27} -body {
28  execsql {
29    WITH tmp AS ( SELECT * FROM t1 )
30    SELECT * FROM tmp;
31  }
32} -test {
33  faultsim_test_result {0 {123 456}}
34  db close
35}
36
37finish_test
38
39
40
41