1 module rfc6265; 2 3 public import vibe.http.common; 4 5 version (unittest) 6 { 7 void safelog(string msg) @trusted @nogc nothrow 8 { 9 import core.stdc.stdio : printf; 10 11 printf("%.*s\n", msg.length, &msg[0]); 12 } 13 14 void testFunctionality()() 15 { 16 auto c = new Cookie; 17 c.value = "foo"; 18 assert(c.value == "foo"); 19 assert(c.rawValue == "foo"); 20 21 c.value = "foo$"; 22 assert(c.value == "foo$"); 23 assert(c.rawValue == "foo%24", c.rawValue); 24 25 c.value = "foo&bar=baz?"; 26 assert(c.value == "foo&bar=baz?"); 27 assert(c.rawValue == "foo%26bar%3Dbaz%3F", c.rawValue); 28 } 29 30 unittest 31 { 32 testFunctionality(); 33 safelog("package works"); 34 } 35 36 @safe unittest 37 { 38 static if (__traits(compiles, testFunctionality())) 39 { 40 pragma(msg, "package is @safe"); 41 } 42 else 43 { 44 pragma(msg, "package is not @safe"); 45 } 46 } 47 48 @nogc unittest 49 { 50 static if (__traits(compiles, testFunctionality())) 51 { 52 pragma(msg, "package is @nogc"); 53 } 54 else 55 { 56 pragma(msg, "package is not @nogc"); 57 } 58 } 59 60 nothrow unittest 61 { 62 static if (__traits(compiles, testFunctionality())) 63 { 64 pragma(msg, "package is nothrow"); 65 } 66 else 67 { 68 pragma(msg, "package is not nothrow"); 69 } 70 } 71 }