mirror of https://github.com/Hax-io/jstruct
parent
b66c7741af
commit
c0bd2d624e
|
@ -280,15 +280,18 @@ unittest
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version(unittest)
|
||||||
|
{
|
||||||
|
import std.string : cmp;
|
||||||
|
import std.stdio : writeln;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Another example deserialization of JSON
|
* Another example deserialization of JSON
|
||||||
* to our `Person` struct
|
* to our `Person` struct
|
||||||
*/
|
*/
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.string : cmp;
|
|
||||||
import std.stdio : writeln;
|
|
||||||
|
|
||||||
struct Person
|
struct Person
|
||||||
{
|
{
|
||||||
public string firstname, lastname;
|
public string firstname, lastname;
|
||||||
|
@ -347,7 +350,6 @@ unittest
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Person person = fromJSON!(Person)(json);
|
Person person = fromJSON!(Person)(json);
|
||||||
import std.stdio : writeln;
|
|
||||||
writeln(person);
|
writeln(person);
|
||||||
assert(true);
|
assert(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,16 +87,19 @@ private enum EnumType
|
||||||
CAT
|
CAT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version(unittest)
|
||||||
|
{
|
||||||
|
import std.algorithm.searching : canFind;
|
||||||
|
import std.string : cmp;
|
||||||
|
import std.stdio : writeln;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Example serialization of our struct
|
* Example serialization of our struct
|
||||||
* `Person` to JSON
|
* `Person` to JSON
|
||||||
*/
|
*/
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.algorithm.searching : canFind;
|
|
||||||
import std.string : cmp;
|
|
||||||
import std.stdio : writeln;
|
|
||||||
|
|
||||||
struct Person
|
struct Person
|
||||||
{
|
{
|
||||||
public string firstname, lastname;
|
public string firstname, lastname;
|
||||||
|
|
Loading…
Reference in New Issue