4d8fa8801ac08f7b098b9caa144d445939a452de
[jansson.git] / test / testprogs / test_load.c
1 /*
2  * Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
3  *
4  * Jansson is free software; you can redistribute it and/or modify
5  * it under the terms of the MIT license. See LICENSE for details.
6  */
7
8 #include <jansson.h>
9 #include <string.h>
10 #include "util.h"
11
12 int main()
13 {
14     json_t *json;
15     json_error_t error;
16
17     json = json_load_file("/path/to/nonexistent/file.json", &error);
18     if(error.line != -1)
19         fail("json_load_file returned an invalid line number");
20     if(strcmp(error.text, "unable to open /path/to/nonexistent/file.json: No such file or directory") != 0)
21         fail("json_load_file returned an invalid error message");
22
23     return 0;
24 }