drh | 0bbaa1b | 2005-08-19 19:14:12 +0000 | [diff] [blame] | 1 | # 2005 September 19 |
| 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 script is testing the ALTER TABLE statement and |
| 13 | # specifically out-of-memory conditions within that command. |
| 14 | # |
danielk1977 | cdc3a6b | 2007-08-25 13:09:26 +0000 | [diff] [blame^] | 15 | # $Id: altermalloc.test,v 1.4 2007/08/25 13:09:26 danielk1977 Exp $ |
drh | 0bbaa1b | 2005-08-19 19:14:12 +0000 | [diff] [blame] | 16 | # |
| 17 | |
| 18 | set testdir [file dirname $argv0] |
| 19 | source $testdir/tester.tcl |
| 20 | |
drh | 0bbaa1b | 2005-08-19 19:14:12 +0000 | [diff] [blame] | 21 | # If SQLITE_OMIT_ALTERTABLE is defined, omit this file. |
| 22 | ifcapable !altertable { |
| 23 | finish_test |
| 24 | return |
| 25 | } |
| 26 | |
danielk1977 | cdc3a6b | 2007-08-25 13:09:26 +0000 | [diff] [blame^] | 27 | source $testdir/malloc_common.tcl |
drh | 0bbaa1b | 2005-08-19 19:14:12 +0000 | [diff] [blame] | 28 | |
| 29 | do_malloc_test altermalloc-1 -tclprep { |
| 30 | db close |
| 31 | } -tclbody { |
| 32 | if {[catch {sqlite3 db test.db}]} { |
| 33 | error "out of memory" |
| 34 | } |
| 35 | } -sqlbody { |
| 36 | CREATE TABLE t1(a int); |
| 37 | ALTER TABLE t1 ADD COLUMN b INTEGER DEFAULT NULL; |
| 38 | ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT 'default-text'; |
| 39 | ALTER TABLE t1 RENAME TO t2; |
| 40 | } |
| 41 | |
| 42 | finish_test |