System.Data.SQLite
Check-in [f49beb5b02]
Not logged in

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

Overview
Comment:Add backup API test case for the callback returning false.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f49beb5b020289ade6c88f507c85e9829a93ee08
User & Date: mistachkin 2012-03-26 09:45:08
Context
2012-03-26
09:52
When compiled for the .NET Compact Framework, skip catching, logging, and re-throwing exceptions in the BackupDatabase method. check-in: a413c10b32 user: mistachkin tags: trunk
09:45
Add backup API test case for the callback returning false. check-in: f49beb5b02 user: mistachkin tags: trunk
09:18
Make all the dynamic test classes static, when possible. check-in: 3f6ed3b646 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Tests/backup.eagle.

    16     16   ###############################################################################
    17     17   
    18     18   package require System.Data.SQLite.Test
    19     19   runSQLiteTestPrologue
    20     20   
    21     21   ###############################################################################
    22     22   
    23         -set params(pages) [list -1 -1 0 0 1 1 1000 1000]
           23  +set params(pages) [list -1 -1 0 0 1 1 2 2 1000 1000]
    24     24   
    25     25   set params(callbacks) [list null "new SQLiteBackupCallback(BackupCallback)" \
           26  +                            null "new SQLiteBackupCallback(BackupCallback)" \
    26     27                               null "new SQLiteBackupCallback(BackupCallback)" \
    27     28                               null "new SQLiteBackupCallback(BackupCallback)" \
    28     29                               null "new SQLiteBackupCallback(BackupCallback)"]
    29     30   
    30     31   set params(results) [list \
    31     32       "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    32     33       1048576 1048576 10\\} 0\$" \
................................................................................
    40     41       thrown by the target of an invocation\\. --->\
    41     42       System\\.Data\\.SQLite\\.SQLiteException: SQLite error\\r\\nno such table:\
    42     43       t1\\r\\n.*?" \
    43     44       "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    44     45       1048576 1048576 10\\} 0\$" \
    45     46       "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    46     47       1048576 1048576 10\\} 10283\$" \
           48  +    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
           49  +    1048576 1048576 10\\} 0\$" \
           50  +    "1 \\{System\\.Reflection\\.TargetInvocationException: Exception has been\
           51  +    thrown by the target of an invocation\\. --->\
           52  +    System\\.Data\\.SQLite\\.SQLiteException: SQLite error\\r\\nno such table:\
           53  +    t1\\r\\n.*?" \
    47     54       "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    48     55       1048576 1048576 10\\} \\{\\}\$" \
    49     56       "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    50     57       1048576 1048576 10\\} \\{System\\.Data\\.SQLite\\.SQLiteConnection main\
    51     58       System\\.Data\\.SQLite\\.SQLiteConnection main 1000 9284 10284 False\
    52     59       System\\.Data\\.SQLite\\.SQLiteConnection main\
    53     60       System\\.Data\\.SQLite\\.SQLiteConnection main 1000 8284 10284 False\
................................................................................
   124    131             {
   125    132               results.AppendFormat("{0} {1} {2} {3} {4} {5} {6} {7} ", source,
   126    133                 sourceName, destination, destinationName, pages, remainingPages,
   127    134                 totalPages, retry);
   128    135   
   129    136               count++;
   130    137   
   131         -            return true;
          138  +            return (pages != 2);
   132    139             }
   133    140   
   134    141             /////////////////////////////////////////////////////////////////////
   135    142   
   136    143             public static string BackupAndGetData(
   137    144               Interpreter interpreter,
   138    145               SQLiteConnection source
................................................................................
   148    155                 source.BackupDatabase(destination, "main", "main", pages,
   149    156                   ${callback}, 0);
   150    157   
   151    158                 ReturnCode code;
   152    159                 Result error = null;
   153    160   
   154    161                 code = interpreter.SetVariableValue(
   155         -                VariableFlags.GlobalOnly, "callbackResults", (pages > 1) ?
          162  +                VariableFlags.GlobalOnly, "callbackResults", (pages > 2) ?
   156    163                       results.ToString().Trim() : count.ToString(), null,
   157    164                   ref error);
   158    165   
   159    166                 if (code != ReturnCode.Ok)
   160    167                   Utility.Complain(interpreter, code, error);
   161    168   
   162    169                 using (SQLiteCommand command = new SQLiteCommand(
................................................................................
   204    211     } -cleanup {
   205    212       cleanupDb $fileName(2)
   206    213       cleanupDb $fileName(1) memDb
   207    214   
   208    215       unset -nocomplain result results errors code index memSource dataSource \
   209    216           id memDb db fileName callbackResults
   210    217     } -constraints \
   211         -  {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
          218  +{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
   212    219   -match regexp -result [appendArgs \
   213    220   "^Ok System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} " \
   214    221   [lindex $params(results) $i]]}
   215    222   }
   216    223   
   217    224   ###############################################################################
   218    225   
   219    226   unset -nocomplain i params pages callback
   220    227   
   221    228   ###############################################################################
   222    229   
   223    230   runSQLiteTestEpilogue
   224    231   runTestEpilogue