File: f_sync_invalid_getlasterror.c

package info (click to toggle)
libmongo-client 0.1.8-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 1,440 kB
  • sloc: ansic: 14,980; makefile: 317; perl: 137; sh: 48
file content (27 lines) | stat: -rw-r--r-- 698 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "test.h"
#include <mongo.h>
#include <errno.h>

void
test_func_mongo_sync_invalid_getlasterror (void)
{
  mongo_sync_connection *conn;
  gchar *error = NULL;
  gboolean res;

  conn = mongo_sync_connect (config.primary_host, config.primary_port,
                             TRUE);

  res = mongo_sync_cmd_get_last_error
    (conn, "1234567890123456789012345678901234567890123456789012345678901234567890",
     &error);

  ok (res == FALSE,
      "Trying to get the last error from an invalid DB results in an error.");
  ok (error == NULL,
      "When getLastError() fails, error remains NULL");

  mongo_sync_disconnect (conn);
}

RUN_NET_TEST (2, func_mongo_sync_invalid_getlasterror);