/ Check-in [65a5bce3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update a few test cases to account for the new error message formats.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 65a5bce3ffb656a43a2e5d2308a4bc67497105de
User & Date: dan 2013-11-28 19:28:00
Context
2013-11-29
15:06
Add a new sqlite3_test_control() that indicates that database files are always well-formed. Use this during testing to enable assert() statements that prove conditions that are always true for well-formed databases. check-in: 15e4f63d user: drh tags: trunk
2013-11-28
19:28
Update a few test cases to account for the new error message formats. check-in: 65a5bce3 user: dan tags: trunk
14:14
Remove an assert() condition that may not be true if the database file is corrupt. Update a test case in corruptC.test. check-in: 0bcf7551 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/fkey_malloc.test.

65
66
67
68
69
70
71


72

73
74
75
76
77
78
79
  set rc [catch {db eval $zSql} msg]
  if {$rc==0} {
    return $msg
  }
  if {[string match {*foreign key*} $msg]} {
    return ""
  }


  if {$msg eq "out of memory" || $msg eq "constraint failed"} {

    error 1
  }
  error $msg
}

do_malloc_test fkey_malloc-4 -sqlprep {
  PRAGMA foreign_keys = 1;







>
>
|
>







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  set rc [catch {db eval $zSql} msg]
  if {$rc==0} {
    return $msg
  }
  if {[string match {*foreign key*} $msg]} {
    return ""
  }
  if {$msg eq "out of memory" 
   || $msg eq "FOREIGN KEY constraint failed"
   || $msg eq "constraint failed"
  } {
    error 1
  }
  error $msg
}

do_malloc_test fkey_malloc-4 -sqlprep {
  PRAGMA foreign_keys = 1;

Changes to test/ioerr.test.

254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
    BEGIN;
    INSERT INTO t1 VALUES('abc', 123);
    INSERT INTO t1 VALUES('def', 123);
    INSERT INTO t1 VALUES('ghi', 123);
    INSERT INTO t1 SELECT (a+500)%900, 'good string' FROM t1;
  }} msg

  if {$msg != "column a is not unique"} {
    error $msg
  }
}

# Assertion fault bug reported by alex dimitrov.
#
do_ioerr_test ioerr-11 -ckrefcount true -erc 1 -sqlprep {







|







254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
    BEGIN;
    INSERT INTO t1 VALUES('abc', 123);
    INSERT INTO t1 VALUES('def', 123);
    INSERT INTO t1 VALUES('ghi', 123);
    INSERT INTO t1 SELECT (a+500)%900, 'good string' FROM t1;
  }} msg

  if {$msg != "UNIQUE constraint failed: t1.a"} {
    error $msg
  }
}

# Assertion fault bug reported by alex dimitrov.
#
do_ioerr_test ioerr-11 -ckrefcount true -erc 1 -sqlprep {

Changes to test/trans2.test.

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
...
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
  #
  do_test trans2-$i.10 {
    catchsql {
      UPDATE t1 SET u1=u1||'x',
          z = CASE WHEN id<$max_rowid
                   THEN zeroblob((random()&65535)%5000 + 1000) END;
    }
  } {1 {t1.z may not be NULL}}
  do_test trans2-$i.11 {
    db eval {SELECT md5sum(u1), md5sum(u2) FROM t1 ORDER BY id}
  } $newres

  # Delete all of the newly inserted records.  Verify that the database
  # is back to its original state.
  #
................................................................................
  #
  do_test trans2-$i.30 {
    catchsql {
      UPDATE t1 SET u1=u1||'x',
          z = CASE WHEN id<$max1
                   THEN zeroblob((random()&65535)%5000 + 1000) END;
    }
  } {1 {t1.z may not be NULL}}
  do_test trans2-$i.31 {
    db eval {SELECT md5sum(u1), md5sum(u2) FROM t1 ORDER BY id}
  } $origres

  # Redo the inserts
  #
  do_test trans2-$i.40 {







|







 







|







157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
...
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
  #
  do_test trans2-$i.10 {
    catchsql {
      UPDATE t1 SET u1=u1||'x',
          z = CASE WHEN id<$max_rowid
                   THEN zeroblob((random()&65535)%5000 + 1000) END;
    }
  } {1 {NOT NULL constraint failed: t1.z}}
  do_test trans2-$i.11 {
    db eval {SELECT md5sum(u1), md5sum(u2) FROM t1 ORDER BY id}
  } $newres

  # Delete all of the newly inserted records.  Verify that the database
  # is back to its original state.
  #
................................................................................
  #
  do_test trans2-$i.30 {
    catchsql {
      UPDATE t1 SET u1=u1||'x',
          z = CASE WHEN id<$max1
                   THEN zeroblob((random()&65535)%5000 + 1000) END;
    }
  } {1 {NOT NULL constraint failed: t1.z}}
  do_test trans2-$i.31 {
    db eval {SELECT md5sum(u1), md5sum(u2) FROM t1 ORDER BY id}
  } $origres

  # Redo the inserts
  #
  do_test trans2-$i.40 {