1 module rfc6902;
2 
3 public import vision.json.patch.commons;
4 public import vision.json.patch.diff;
5 public import vision.json.patch.patch;
6 
7 version (unittest)
8 {
9 	import std.json;
10 
11 	void safelog(string msg) @trusted @nogc nothrow
12 	{
13 		import core.stdc.stdio : printf;
14 
15 		printf("%.*s\n", msg.length, &msg[0]);
16 	}
17 
18 	void testFunctionality()(JSONValue j)
19 	{
20 		diff(j, j).toJson();
21 	}
22 
23 	unittest
24 	{
25 		string s = `{ "language": "D", "rating": 3.5, "code": "42", "o": {"p1": 5, "p2": 6}, "a": [1,2,3,4,5] }`;
26 		JSONValue j = parseJSON(s);
27 
28 		testFunctionality(j);
29 		safelog("package works");
30 
31 		static assert(__traits(compiles, testFunctionality(JSONValue.init)), "package doesn't work");
32 	}
33 
34 	@safe unittest
35 	{
36 		static if (__traits(compiles, testFunctionality(JSONValue.init)))
37 		{
38 			pragma(msg, "package is @safe");
39 		}
40 		else
41 		{
42 			pragma(msg, "package is not @safe");
43 		}
44 	}
45 
46 	@nogc unittest
47 	{
48 		static if (__traits(compiles, testFunctionality(JSONValue.init)))
49 		{
50 			pragma(msg, "package is @nogc");
51 		}
52 		else
53 		{
54 			pragma(msg, "package is not @nogc");
55 		}
56 	}
57 
58 	nothrow unittest
59 	{
60 		static if (__traits(compiles, testFunctionality(JSONValue.init)))
61 		{
62 			pragma(msg, "package is nothrow");
63 		}
64 		else
65 		{
66 			pragma(msg, "package is not nothrow");
67 		}
68 	}
69 }