Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/storage/test/unit/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  test_storage_ext.js   Sprache: JAVA

 
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


// This file tests basics of loading SQLite extension.

const VALID_EXTENSION_NAME = "fts5";

add_setup(async function () {
  cleanup();
});

add_task(async function test_valid_call() {
  info("Testing valid call");
  let conn = getOpenedUnsharedDatabase();

  await new Promise((resolve, reject) => {
    conn.loadExtension(VALID_EXTENSION_NAME, status => {
      if (Components.isSuccessCode(status)) {
        resolve();
      } else {
        reject(status);
      }
    });
  });

  cleanup();
});

add_task(async function test_invalid_calls() {
  info("Testing invalid calls");
  let conn = getOpenedUnsharedDatabase();

  await Assert.rejects(
    new Promise((resolve, reject) => {
      conn.loadExtension("unknown", status => {
        if (Components.isSuccessCode(status)) {
          resolve();
        } else {
          reject(status);
        }
      });
    }),
    /NS_ERROR_ILLEGAL_VALUE/,
    "Should fail loading unknown extension"
  );

  cleanup();

  await Assert.rejects(
    new Promise((resolve, reject) => {
      conn.loadExtension(VALID_EXTENSION_NAME, status => {
        if (Components.isSuccessCode(status)) {
          resolve();
        } else {
          reject(status);
        }
      });
    }),
    /NS_ERROR_NOT_INITIALIZED/,
    "Should fail loading extension on a closed connection"
  );
});

add_task(async function test_more_invalid_calls() {
  let conn = getOpenedUnsharedDatabase();
  let promiseClosed = asyncClose(conn);

  await Assert.rejects(
    new Promise((resolve, reject) => {
      conn.loadExtension(VALID_EXTENSION_NAME, status => {
        if (Components.isSuccessCode(status)) {
          resolve();
        } else {
          reject(status);
        }
      });
    }),
    /NS_ERROR_NOT_INITIALIZED/,
    "Should fail loading extension on a closing connection"
  );

  await promiseClosed;
});

Messung V0.5
C=95 H=97 G=95

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.