Overview
Comment: | Fix compilation of tests |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
04c3ced613448bb557d961e41ea903a5 |
User & Date: | js 2018-02-25 23:56:16 |
Context
2018-11-06
| ||
21:29 | Adjust to ObjFW changes check-in: 5d46842834 user: js tags: trunk | |
2018-02-25
| ||
23:56 | Fix compilation of tests check-in: 04c3ced613 user: js tags: trunk | |
23:50 | Add support for building as a .framework check-in: e3441508b5 user: js tags: trunk | |
Changes
Changes to tests/Makefile.
1 2 3 4 5 6 | PROG_NOINST = tests SRCS = tests.m include ../buildsys.mk CPPFLAGS += -I../src -I../src/exceptions | > > | | 1 2 3 4 5 6 7 8 9 10 | include ../extra.mk PROG_NOINST = tests SRCS = tests.m include ../buildsys.mk CPPFLAGS += -I../src -I../src/exceptions LIBS := -L../src -lobjpgsql ${OBJFW_LIBS} ${LIBS} LD = ${OBJC} |
Changes to tests/tests.m.
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018 * Jonathan Schleifer <js@heap.zone> * * https://heap.zone/git/objpgsql.git * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice is present in all copies. |
︙ | ︙ | |||
22 23 24 25 26 27 28 | */ #import <ObjFW/ObjFW.h> #import "PGConnection.h" #import "PGConnectionFailedException.h" | | | | | | | | | | | | | | | | | | | | | | | | | | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | */ #import <ObjFW/ObjFW.h> #import "PGConnection.h" #import "PGConnectionFailedException.h" @interface Test: OFObject <OFApplicationDelegate> { PGConnection *_connection; } @end OF_APPLICATION_DELEGATE(Test) @implementation Test - (void)applicationDidFinishLaunching { OFString *username = [[OFApplication environment] objectForKey: @"USER"]; PGResult *result; _connection = [[PGConnection alloc] init]; [_connection setParameters: [OFDictionary dictionaryWithKeysAndObjects: @"user", username, @"dbname", username, nil]]; [_connection connect]; [_connection executeCommand: @"DROP TABLE IF EXISTS test"]; [_connection executeCommand: @"CREATE TABLE test (" @" id integer," @" name varchar(255)," @" content text," @" success boolean" @")"]; [_connection executeCommand: @"INSERT INTO test (id, name, content) " @"VALUES ($1, $2, $3)" parameters: [OFNumber numberWithInt: 1], @"foo", @"Hallo Welt!", nil]; [_connection executeCommand: @"INSERT INTO test (id, content, success) " @"VALUES ($1, $2, $3)" parameters: [OFNumber numberWithInt: 2], [OFNumber numberWithInt: 2], [OFNumber numberWithBool: true], nil]; [_connection insertRow: [OFDictionary dictionaryWithKeysAndObjects: @"content", @"Hallo!", @"name", @"foo", nil] intoTable: @"test"]; result = [_connection executeCommand: @"SELECT * FROM test"]; of_log(@"%@", result); of_log(@"JSON: %@", [result JSONRepresentation]); for (id row in result) for (id col in row) of_log(@"%@", col); result = [_connection executeCommand: @"SELECT COUNT(*) FROM test"]; of_log(@"%@", result); [OFApplication terminate]; } @end |