Skip to content
This repository
  • 2 commits
  • 25 files changed
  • 0 comments
  • 1 contributor
2  VERSION
@@ -10,7 +10,7 @@ dumper: 1 Stable
10 10 event: 4 Alpha
11 11 filesystem: 1 Stable
12 12 harness: 3 Stable
13   -json: 0 Alpha
  13 +json: 1 Stable
14 14 lazy: 0 Alpha
15 15 memoize: 1 Stable
16 16 mockobject: 2 Stable
22 setup.winxed
@@ -329,6 +329,17 @@ function setup_stable_libraries(var rosella)
329 329 setup_winxed_lib(rosella, "parse", ["Core", "Ascii", "Parse_builtins"],
330 330 "parse/Parse"
331 331 );
  332 +
  333 + setup_winxed_lib(rosella, "json", ["Core", "Ascii", "Parse_builtins", "Parse", "Dumper"],
  334 + "json/Includes",
  335 + "json/Json",
  336 + "json/Builder",
  337 + "json/builder/Factory",
  338 + "json/builder/DataObject",
  339 + "json/Dumper",
  340 + "json/DumpHandler",
  341 + "json/Parser"
  342 + );
332 343 }
333 344
334 345 function setup_experimental_libraries(var rosella)
@@ -414,17 +425,6 @@ function setup_experimental_libraries(var rosella)
414 425 "xml/Tag",
415 426 "xml/Text"
416 427 );
417   -
418   - setup_unstable_lib(rosella, "json", ["Core", "Ascii", "Parse_builtins", "Parse", "Dumper"],
419   - "json/Includes",
420   - "json/Json",
421   - "json/Builder",
422   - "json/builder/Factory",
423   - "json/builder/DataObject",
424   - "json/Dumper",
425   - "json/DumpHandler",
426   - "json/Parser"
427   - );
428 428 }
429 429
430 430 function setup_utilities(var rosella)
30 src/unstable/json/Builder.winxed
... ... @@ -1,30 +0,0 @@
1   -class Rosella.Json.Builder
2   -{
3   - function Builder()
4   - {
5   - Rosella.Error.error("Rosella.Json.Builder is an abstract parent type and should not be used directly");
6   - }
7   -
8   - function start() { }
9   -
10   - function start_array(string name) { }
11   -
12   - function end_array() { }
13   -
14   - function start_object(string name) { }
15   -
16   - function end_object() { }
17   -
18   - function add_string(string name, string value) { }
19   -
20   - function add_integer(string name, int value) { }
21   -
22   - function add_number(string name, float value) { }
23   -
24   - function add_boolean(string name, int value) { }
25   -
26   - function add_null(string name) { }
27   -
28   - function get_value() { }
29   -
30   -}
101 src/unstable/json/DumpHandler.winxed
... ... @@ -1,101 +0,0 @@
1   -class Rosella.Json.DumpHandler.Array : Rosella.Dumper.DumpHandler.Array
2   -{
3   - // Dump the array
4   - function dump(var dump, var emit, var obj)
5   - {
6   - emit.array(function() {
7   - for (int i = 0; i < elements(obj); i++) {
8   - dump.__dump_recurse(emit, obj[i]);
9   - if (i != elements(obj) - 1)
10   - emit.text(", ");
11   - }
12   - });
13   - }
14   -}
15   -
16   -class Rosella.Json.DumpHandler.Hash : Rosella.Dumper.DumpHandler.Hash
17   -{
18   - function dump(var dump, var emit, var obj)
19   - {
20   - emit.hash(function() {
21   - var i = get_iterator(obj);
22   - if (!i)
23   - return;
24   - string key = shift_string(i);
25   - emit.text_line("'%s' : ", key);
26   - dump.__dump_recurse(emit, obj[key]);
27   - while (i) {
28   - emit.text(",");
29   - key = shift_string(i);
30   - emit.text_line("'%s' : ", key);
31   - dump.__dump_recurse(emit, obj[key]);
32   - }
33   - });
34   - }
35   -}
36   -
37   -class Rosella.Json.DumpHandler.Object : Rosella.Dumper.DumpHandler.Object
38   -{
39   - function dump(var dump, var emit, var obj)
40   - {
41   - emit.hash(function() {
42   - var seen_attrs = {};
43   - var class_obj = typeof(obj);
44   - for (var parent in class_obj.inspect("all_parents")) {
45   - for (string key in parent.attributes()) {
46   - if (!(exists seen_attrs[key])) {
47   - seen_attrs[key] = true;
48   - }
49   - }
50   - }
51   -
52   - var i = get_iterator(seen_attrs);
53   - if (!i)
54   - return;
55   - string key = shift_string(i);
56   - emit.text_line("'%s' : ", key);
57   - dump.__dump_recurse(emit, obj.*key);
58   - while (i) {
59   - emit.text(", ");
60   - key = shift_string(i);
61   - emit.text_line("'%s' : ", key);
62   - dump.__dump_recurse(emit, obj.*key);
63   - }
64   - });
65   - }
66   -}
67   -
68   -class Rosella.Json.DumpHandler.Null : Rosella.Dumper.DumpHandler
69   -{
70   - function can_dump(var obj) { return obj == null; }
71   -
72   - function dump(var dump, var emit, var obj) { emit.text("null"); }
73   -}
74   -
75   -class Rosella.Json.DumpHandler.Integer : Rosella.Dumper.DumpHandler
76   -{
77   - function can_dump(var obj) { return true; }
78   -
79   - function dump(var dump, var emit, var obj) { emit.text("%d", int(obj)); }
80   -}
81   -
82   -class Rosella.Json.DumpHandler.Float : Rosella.Dumper.DumpHandler
83   -{
84   - function can_dump(var obj) { return true; }
85   -
86   - function dump(var dump, var emit, var obj) { emit.text("%f", float(obj)); }
87   -}
88   -
89   -class Rosella.Json.DumpHandler.String : Rosella.Dumper.DumpHandler
90   -{
91   - function can_dump(var obj) { return true; }
92   -
93   - function dump(var dump, var emit, var obj) { emit.text("'%s'", obj); }
94   -}
95   -
96   -class Rosella.Json.DumpHandler.Boolean : Rosella.Dumper.DumpHandler
97   -{
98   - function can_dump(var obj) { return true; }
99   -
100   - function dump(var dump, var emit, var obj) { emit.text(obj ? "true" : "false"); }
101   -}
41 src/unstable/json/Dumper.winxed
... ... @@ -1,41 +0,0 @@
1   -class Rosella.Json.Dumper : Rosella.Dumper
2   -{
3   - // Get the default set of role dumpers
4   - function default_role_dumpers()
5   - {
6   - return {
7   - "array" : new Rosella.Json.DumpHandler.Array,
8   - "hash" : new Rosella.Json.DumpHandler.Hash
9   - };
10   - }
11   -
12   - // Get the default set of miscellaneous dumpers
13   - function default_misc_dumpers()
14   - {
15   - return {
16   - "object" : new Rosella.Json.DumpHandler.Object
17   - };
18   - }
19   -
20   - function default_type_dumpers()
21   - {
22   - return {
23   - "Integer" : new Rosella.Json.DumpHandler.Integer,
24   - "Float" : new Rosella.Json.DumpHandler.Float,
25   - "String" : new Rosella.Json.DumpHandler.String,
26   - "Boolean" : new Rosella.Json.DumpHandler.Boolean
27   - };
28   - }
29   -
30   -
31   - // Get the default fallback dumper
32   - function default_fallback_dumper()
33   - {
34   - return null;
35   - }
36   -
37   - function default_null_dumper()
38   - {
39   - return new Rosella.Json.DumpHandler.Null;
40   - }
41   -}
0  src/unstable/json/Includes.winxed
No changes.
26 src/unstable/json/Json.winxed
... ... @@ -1,26 +0,0 @@
1   -namespace Rosella.Json
2   -{
3   - function to_json(var obj)
4   - {
5   - var dumper = new Rosella.Json.Dumper();
6   - return dumper.dump(obj);
7   - }
8   -
9   - function parse(string json, var builder = null)
10   - {
11   - :(json, var s, var b, int len) = Rosella.Parse.setup_parse(json);
12   - if (builder == null)
13   - builder = Rosella.Json.default_builder_factory().create();
14   - builder.start();
15   - Rosella.Json.Parser.__parse_value(json, s, b, len, "", builder);
16   - return builder.get_value();
17   - }
18   -
19   - const string DEFAULT_BUILDER_FACTORY = "Rosella.Json.default_builder_factory";
20   - function default_builder_factory()
21   - {
22   - return Rosella.Globals.autoget_global(DEFAULT_BUILDER_FACTORY,
23   - function () { return new Rosella.Json.Builder.Factory(); }
24   - );
25   - }
26   -}
127 src/unstable/json/Parser.winxed
... ... @@ -1,127 +0,0 @@
1   -namespace Rosella.Json.Parser
2   -{
3   - function __parse_value(string json, var s, var b, int len, string name, var builder)
4   - {
5   - eat_whitespace(s, b);
6   - int c = get_next(s, b);
7   - var d;
8   -
9   - if (c == ASCII_NULL)
10   - Rosella.Parse.error_unknown_char(ASCII_NULL, "json parse value", current_position(len, s, b));
11   - if (c == ASCII_OPEN_CURLY) {
12   - builder.start_object(name);
13   - __parse_object(json, s, b, len, builder);
14   - builder.end_object();
15   - return;
16   - }
17   - if (c == ASCII_OPEN_BRACKET) {
18   - builder.start_array(name);
19   - __parse_array(json, s, b, len, builder);
20   - builder.end_array();
21   - return;
22   - }
23   - if (c == ASCII_SINGLE_QUOTE || c == ASCII_DOUBLE_QUOTE) {
24   - string value = Rosella.Parse.parse_string(c, json, s, b, len);
25   - builder.add_string(name, value);
26   - return;
27   - }
28   - if (codepoint_is_digit(c)) {
29   - float value = Rosella.Parse.parse_number(c, json, s, b, len);
30   - builder.add_number(name, value);
31   - return;
32   - }
33   - if (c == ASCII_t) {
34   - if (get_next(s, b) == ASCII_r &&
35   - get_next(s, b) == ASCII_u &&
36   - get_next(s, b) == ASCII_e) {
37   - builder.add_boolean(name, true);
38   - return;
39   - }
40   - Rosella.Parse.error_unknown_char(c, "json boolean true", current_position(len, s, b));
41   - }
42   - if (c == ASCII_f) {
43   - if (get_next(s, b) == ASCII_a &&
44   - get_next(s, b) == ASCII_l &&
45   - get_next(s, b) == ASCII_s &&
46   - get_next(s, b) == ASCII_e) {
47   - builder.add_boolean(name, false);
48   - return;
49   - }
50   - Rosella.Parse.error_unknown_char(c, "json boolean false", current_position(len, s, b));
51   - }
52   - if (c == ASCII_n) {
53   - if (get_next(s, b) == ASCII_u &&
54   - get_next(s, b) == ASCII_l &&
55   - get_next(s, b) == ASCII_l) {
56   - builder.add_null(name);
57   - return;
58   - }
59   - Rosella.Parse.error_unknown_char(c, "json null", current_position(len, s, b));
60   - }
61   - Rosella.Parse.error_unknown_char(c, "parse json value", current_position(len, s, b));
62   - }
63   -
64   - function __parse_object(string json, var s, var b, int len, var builder)
65   - {
66   - while(have_more_chars(s, b)) {
67   - eat_whitespace(s, b);
68   - int c = get_next(s, b);
69   - if (c == ASCII_SINGLE_QUOTE || c == ASCII_DOUBLE_QUOTE) {
70   - string str = Rosella.Parse.parse_string(c, json, s, b, len);
71   - eat_whitespace(s, b);
72   - c = get_next(s, b);
73   - if (c != ASCII_COLON)
74   - Rosella.Parse.error_unknown_char(c, "json object", current_position(len, s, b));
75   - __parse_value(json, s, b, len, str, builder);
76   - eat_whitespace(s, b);
77   - c = get_next(s, b);
78   - if (c == ASCII_COMMA)
79   - continue;
80   - if (c == ASCII_CLOSE_CURLY)
81   - return;
82   - } else if (codepoint_is_alpha(c)) {
83   - unshift_int(s, c);
84   - string str = Rosella.Parse.parse_alphanumeric(json, s, b, len);
85   - eat_whitespace(s, b);
86   - c = get_next(s, b);
87   - if (c != ASCII_COLON)
88   - Rosella.Parse.error_unknown_char(c, "json object", current_position(len, s, b));
89   - __parse_value(json, s, b, len, str, builder);
90   - eat_whitespace(s, b);
91   - c = get_next(s, b);
92   - if (c == ASCII_COMMA)
93   - continue;
94   - if (c == ASCII_CLOSE_CURLY)
95   - return;
96   - }
97   - else if (c == ASCII_CLOSE_CURLY)
98   - return;
99   - Rosella.Parse.error_unknown_char(c, "json object", current_position(len, s, b));
100   - }
101   - Rosella.Parse.error_unknown_char(ASCII_NULL, "json object", current_position(len, s, b));
102   - }
103   -
104   - function __parse_array(string json, var s, var b, int len, var builder)
105   - {
106   - eat_whitespace(s, b);
107   - int c = get_next(s, b);
108   - if (c == ASCII_CLOSE_BRACKET)
109   - return;
110   - unshift_int(s, c);
111   - int idx = 0;
112   - while(have_more_chars(s, b)) {
113   - __parse_value(json, s, b, len, idx, builder);
114   - idx++;
115   - eat_whitespace(s, b);
116   - c = get_next(s, b);
117   - if (c == ASCII_CLOSE_BRACKET)
118   - return;
119   - if (c == ASCII_COMMA) {
120   - eat_whitespace(s, b);
121   - continue;
122   - }
123   - Rosella.Parse.error_unknown_char(c, "json array", current_position(len, s, b));
124   - }
125   - Rosella.Parse.error_unknown_char(ASCII_NULL, "json array", current_position(len, s, b));
126   - }
127   -}
112 src/unstable/json/builder/DataObject.winxed
... ... @@ -1,112 +0,0 @@
1   -class Rosella.Json.Builder.DataObject : Rosella.Json.Builder
2   -{
3   - var stack;
4   - var current;
5   - var root;
6   -
7   - function DataObject()
8   - {
9   - self.stack = [];
10   - self.current = null;
11   - self.root = null;
12   - }
13   -
14   - function start() { }
15   -
16   - function start_array(string name)
17   - {
18   - var a = [];
19   - if (self.current != null) {
20   - if (self.current instanceof 'ResizablePMCArray') {
21   - //int idx = int(name);
22   - // TODO: We can safely assume that the value is next in line
23   - push(self.current, a);
24   - } else if (self.current instanceof 'Hash') {
25   - self.current[name] = a;
26   - }
27   - } else {
28   - self.root = a;
29   - }
30   - push(self.stack, self.current);
31   - self.current = a;
32   - }
33   -
34   - function end_array()
35   - {
36   - self.current = self.stack.pop();
37   - }
38   -
39   - function start_object(string name)
40   - {
41   - var a = {};
42   - if (self.current != null) {
43   - if (self.current instanceof 'ResizablePMCArray') {
44   - //int idx = int(name);
45   - // TODO: We can safely assume that the value is next in line
46   - push(self.current, a);
47   - } else if (self.current instanceof 'Hash') {
48   - self.current[name] = a;
49   - }
50   - } else {
51   - self.root = a;
52   - }
53   - push(self.stack, a);
54   - self.current = a;
55   - }
56   -
57   - function end_object()
58   - {
59   - self.current = self.stack.pop();
60   - }
61   -
62   - function add_string(string name, string value)
63   - {
64   - if (self.current == null)
65   - self.root = var(value);
66   - else if (self.current instanceof 'ResizablePMCArray')
67   - push(self.current, var(value));
68   - else if (self.current instanceof 'Hash')
69   - self.current[name] = value;
70   - }
71   -
72   - function add_integer(string name, int value)
73   - {
74   - if (self.current == null)
75   - self.root = var(value);
76   - else if (self.current instanceof 'ResizablePMCArray')
77   - push(self.current, var(value));
78   - else if (self.current instanceof 'Hash')
79   - self.current[name] = value;
80   - }
81   -
82   - function add_number(string name, float value)
83   - {
84   - if (self.current == null)
85   - self.root = value;
86   - else if (self.current instanceof 'ResizablePMCArray')
87   - push(self.current, var(value));
88   - else if (self.current instanceof 'Hash')
89   - self.current[name] = value;
90   - }
91   -
92   - function add_boolean(string name, int value)
93   - {
94   - var v = new 'Boolean'(value);
95   - if (self.current == null)
96   - self.root = v;
97   - else if (self.current instanceof 'ResizablePMCArray')
98   - push(self.current, v);
99   - else if (self.current instanceof 'Hash')
100   - self.current[name] = v;
101   - }
102   -
103   - function add_null(string name)
104   - {
105   - if (self.current instanceof 'ResizablePMCArray')
106   - push(self.current, null);
107   - else if (self.current instanceof 'Hash')
108   - self.current[name] = null;
109   - }
110   -
111   - function get_value() { return self.root; }
112   -}
7 src/unstable/json/builder/Factory.winxed
... ... @@ -1,7 +0,0 @@
1   -class Rosella.Json.Builder.Factory : Rosella.ObjectFactory
2   -{
3   - function Factory()
4   - {
5   - self.ObjectFactory(class Rosella.Json.Builder.DataObject);
6   - }
7   -}
2  t/harness
@@ -19,6 +19,7 @@ sub library_tests() {
19 19 %h{"filesystem"} := "NQP";
20 20 %h{"memoize"} := "NQP";
21 21 %h{"mockobject"} := "NQP";
  22 + %h{"parse"} := "Winxed";
22 23 %h{"path"} := "NQP";
23 24 %h{"proxy"} := "NQP";
24 25 %h{"query"} := "Winxed";
@@ -36,6 +37,7 @@ sub unstable_tests() {
36 37 my %h := {};
37 38 %h{"container"} := "Winxed";
38 39 %h{"event"} := "Winxed";
  40 + %h{"json"} := "Winxed";
39 41 %h{"prototype"} := "NQP";
40 42 %h{"decorate"} := "Winxed";
41 43 %h{"xml"} := "Winxed";
18 t/json/Builder.t
... ... @@ -0,0 +1,18 @@
  1 +class Test_Rosella_Json_Builder
  2 +{
  3 +}
  4 +
  5 +function initialize_test[anon](var context)
  6 +{
  7 + // Set up the test suite here. Set options on the Suite, set up matchers
  8 + // in the matcher factory, load prerequisites, and do other things.
  9 + var(Rosella.load_bytecode_file)("rosella/json.pbc", "load");
  10 +}
  11 +
  12 +function main[main]()
  13 +{
  14 + var core = load_packfile("rosella/core.pbc");
  15 + var(Rosella.initialize_rosella)("test");
  16 + using initialize_test;
  17 + var(Rosella.Test.test)(class Test_Rosella_Json_Builder, initialize_test:[named("initialize")]);
  18 +}
124 t/json/Builder/DataObject.t
... ... @@ -0,0 +1,124 @@
  1 +// Automatically generated test for Class Rosella.Json.Builder.DataObject
  2 +function create_new(var p_args [slurpy], var n_args [slurpy,named])
  3 +{
  4 + return new Rosella.Json.Builder.DataObject(p_args:[flat], n_args:[flat,named]);
  5 +}
  6 +
  7 +class Test_Rosella_Json_Builder_DataObject
  8 +{
  9 + function test_new()
  10 + {
  11 + // Test simple constructor. For most individual method tests, use create_new() above
  12 + var obj = new Rosella.Json.Builder.DataObject();
  13 + self.assert.not_null(obj);
  14 + self.assert.instance_of(obj, class Rosella.Json.Builder.DataObject);
  15 + }
  16 +
  17 + function start()
  18 + {
  19 + self.status.verify("Test Rosella.Json.Builder.DataObject.start()");
  20 + var obj = create_new();
  21 +
  22 + obj.start();
  23 + }
  24 +
  25 + function start_array()
  26 + {
  27 + self.status.verify("Test Rosella.Json.Builder.DataObject.start_array()");
  28 + var obj = create_new();
  29 +
  30 + string arg_0 = "foo";
  31 + obj.start_array(arg_0);
  32 + }
  33 +
  34 + function end_array()
  35 + {
  36 + self.status.verify("Test Rosella.Json.Builder.DataObject.end_array()");
  37 + var obj = create_new();
  38 +
  39 + obj.start_array("foo");
  40 + obj.end_array();
  41 + }
  42 +
  43 + function start_object()
  44 + {
  45 + self.status.verify("Test Rosella.Json.Builder.DataObject.start_object()");
  46 + var obj = create_new();
  47 +
  48 + string arg_0 = "foo";
  49 + obj.start_object(arg_0);
  50 + }
  51 +
  52 + function end_object()
  53 + {
  54 + self.status.verify("Test Rosella.Json.Builder.DataObject.end_object()");
  55 + var obj = create_new();
  56 +
  57 + obj.start_object("foo");
  58 + obj.end_object();
  59 + }
  60 +
  61 + function add_string()
  62 + {
  63 + self.status.verify("Test Rosella.Json.Builder.DataObject.add_string()");
  64 + var obj = create_new();
  65 +
  66 + string arg_0 = "foo";
  67 + string arg_1 = "bar";
  68 + obj.add_string(arg_0, arg_1);
  69 + }
  70 +
  71 + function add_integer()
  72 + {
  73 + self.status.verify("Test Rosella.Json.Builder.DataObject.add_integer()");
  74 + var obj = create_new();
  75 +
  76 + string arg_0 = "foo";
  77 + int arg_1 = 123;
  78 + obj.add_integer(arg_0, arg_1);
  79 + }
  80 +
  81 + function add_number()
  82 + {
  83 + self.status.verify("Test Rosella.Json.Builder.DataObject.add_number()");
  84 + var obj = create_new();
  85 +
  86 + string arg_0 = "foo";
  87 + float arg_1 = 3.14;
  88 + obj.add_number(arg_0, arg_1);
  89 + }
  90 +
  91 + function add_boolean()
  92 + {
  93 + self.status.verify("Test Rosella.Json.Builder.DataObject.add_boolean()");
  94 + var obj = create_new();
  95 +
  96 + string arg_0 = "foo";
  97 + int arg_1 = true;
  98 + obj.add_boolean(arg_0, arg_1);
  99 + }
  100 +
  101 + function add_null()
  102 + {
  103 + self.status.verify("Test Rosella.Json.Builder.DataObject.add_null()");
  104 + var obj = create_new();
  105 +
  106 + string arg_0 = "foo";
  107 + obj.add_null(arg_0);
  108 + }
  109 +}
  110 +
  111 +function initialize_test[anon](var context)
  112 +{
  113 + // Set up the test suite here. Set options on the Suite, set up matchers
  114 + // in the matcher factory, load prerequisites, and do other things.
  115 + var(Rosella.load_bytecode_file)("rosella/json.pbc", "load");
  116 +}
  117 +
  118 +function main[main]()
  119 +{
  120 + var core = load_packfile("rosella/core.pbc");
  121 + var(Rosella.initialize_rosella)("test");
  122 + using initialize_test;
  123 + var(Rosella.Test.test)(class Test_Rosella_Json_Builder_DataObject, initialize_test:[named("initialize")]);
  124 +}
31 t/json/Builder/Factory.t
... ... @@ -0,0 +1,31 @@
  1 +// Automatically generated test for Class Rosella.Json.Builder.Factory
  2 +function create_new(var p_args [slurpy], var n_args [slurpy,named])
  3 +{
  4 + return new Rosella.Json.Builder.Factory(p_args:[flat], n_args:[flat,named]);
  5 +}
  6 +
  7 +class Test_Rosella_Json_Builder_Factory
  8 +{
  9 + function test_new()
  10 + {
  11 + // Test simple constructor. For most individual method tests, use create_new() above
  12 + var obj = new Rosella.Json.Builder.Factory();
  13 + self.assert.not_null(obj);
  14 + self.assert.instance_of(obj, class Rosella.Json.Builder.Factory);
  15 + }
  16 +}
  17 +
  18 +function initialize_test[anon](var context)
  19 +{
  20 + // Set up the test suite here. Set options on the Suite, set up matchers
  21 + // in the matcher factory, load prerequisites, and do other things.
  22 + var(Rosella.load_bytecode_file)("rosella/json.pbc", "load");
  23 +}
  24 +
  25 +function main[main]()
  26 +{
  27 + var core = load_packfile("rosella/core.pbc");
  28 + var(Rosella.initialize_rosella)("test");
  29 + using initialize_test;
  30 + var(Rosella.Test.test)(class Test_Rosella_Json_Builder_Factory, initialize_test:[named("initialize")]);
  31 +}
33 t/json/DumpHandler/Array.t
... ... @@ -0,0 +1,33 @@
  1 +// Automatically generated test for Class Rosella.Json.DumpHandler.Array
  2 +function create_new(var p_args [slurpy], var n_args [slurpy,named])
  3 +{
  4 + return new Rosella.Json.DumpHandler.Array;
  5 +}
  6 +
  7 +class Test_Rosella_Json_DumpHandler_Array
  8 +{
  9 + function can_dump()
  10 + {
  11 + self.status.verify("Test Rosella.Json.DumpHandler.Array.can_dump()");
  12 + var obj = create_new();
  13 +
  14 + var arg_0 = [];
  15 + int result = obj.can_dump(arg_0);
  16 + self.assert.is_true(result);
  17 + }
  18 +}
  19 +
  20 +function initialize_test[anon](var context)
  21 +{
  22 + // Set up the test suite here. Set options on the Suite, set up matchers
  23 + // in the matcher factory, load prerequisites, and do other things.
  24 + var(Rosella.load_bytecode_file)("rosella/json.pbc", "load");
  25 +}
  26 +
  27 +function main[main]()
  28 +{
  29 + var core = load_packfile("rosella/core.pbc");
  30 + var(Rosella.initialize_rosella)("test");
  31 + using initialize_test;
  32 + var(Rosella.Test.test)(class Test_Rosella_Json_DumpHandler_Array, initialize_test:[named("initialize")]);
  33 +}
33 t/json/DumpHandler/Boolean.t
... ... @@ -0,0 +1,33 @@
  1 +// Automatically generated test for Class Rosella.Json.DumpHandler.Boolean
  2 +function create_new(var p_args [slurpy], var n_args [slurpy,named])
  3 +{
  4 + return new Rosella.Json.DumpHandler.Boolean;
  5 +}
  6 +
  7 +class Test_Rosella_Json_DumpHandler_Boolean
  8 +{
  9 + function can_dump()
  10 + {
  11 + self.status.verify("Test Rosella.Json.DumpHandler.Boolean.can_dump()");
  12 + var obj = create_new();
  13 +
  14 + var arg_0 = new 'Boolean';
  15 + int result = obj.can_dump(arg_0);
  16 + self.assert.is_true(result);
  17 + }
  18 +}
  19 +
  20 +function initialize_test[anon](var context)
  21 +{
  22 + // Set up the test suite here. Set options on the Suite, set up matchers
  23 + // in the matcher factory, load prerequisites, and do other things.
  24 + var(Rosella.load_bytecode_file)("rosella/json.pbc", "load");
  25 +}
  26 +
  27 +function main[main]()
  28 +{
  29 + var core = load_packfile("rosella/core.pbc");
  30 + var(Rosella.initialize_rosella)("test");
  31 + using initialize_test;
  32 + var(Rosella.Test.test)(class Test_Rosella_Json_DumpHandler_Boolean, initialize_test:[named("initialize")]);
  33 +}
33 t/json/DumpHandler/Float.t
... ... @@ -0,0 +1,33 @@
  1 +// Automatically generated test for Class Rosella.Json.DumpHandler.Float
  2 +function create_new(var p_args [slurpy], var n_args [slurpy,named])
  3 +{
  4 + return new Rosella.Json.DumpHandler.Float;
  5 +}
  6 +
  7 +class Test_Rosella_Json_DumpHandler_Float
  8 +{
  9 + function can_dump()
  10 + {
  11 + self.status.verify("Test Rosella.Json.DumpHandler.Float.can_dump()");
  12 + var obj = create_new();
  13 +
  14 + var arg_0 = 3.14;
  15 + int result = obj.can_dump(arg_0);
  16 + self.assert.is_true(result);
  17 + }
  18 +}
  19 +
  20 +function initialize_test[anon](var context)
  21 +{
  22 + // Set up the test suite here. Set options on the Suite, set up matchers
  23 + // in the matcher factory, load prerequisites, and do other things.
  24 + var(Rosella.load_bytecode_file)("rosella/json.pbc", "load");
  25 +}
  26 +
  27 +function main[main]()
  28 +{
  29 + var core = load_packfile("rosella/core.pbc");
  30 + var(Rosella.initialize_rosella)("test");
  31 + using initialize_test;
  32 + var(Rosella.Test.test)(class Test_Rosella_Json_DumpHandler_Float, initialize_test:[named("initialize")]);
  33 +}
33 t/json/DumpHandler/Hash.t
... ... @@ -0,0 +1,33 @@
  1 +// Automatically generated test for Class Rosella.Json.DumpHandler.Hash
  2 +function create_new(var p_args [slurpy], var n_args [slurpy,named])
  3 +{
  4 + return new Rosella.Json.DumpHandler.Hash;
  5 +}
  6 +
  7 +class Test_Rosella_Json_DumpHandler_Hash
  8 +{
  9 + function can_dump()
  10 + {
  11 + self.status.verify("Test Rosella.Json.DumpHandler.Float.can_dump()");
  12 + var obj = create_new();
  13 +
  14 + var arg_0 = {};
  15 + int result = obj.can_dump(arg_0);
  16 + self.assert.is_true(result);
  17 + }
  18 +}
  19 +
  20 +function initialize_test[anon](var context)
  21 +{
  22 + // Set up the test suite here. Set options on the Suite, set up matchers
  23 + // in the matcher factory, load prerequisites, and do other things.
  24 + var(Rosella.load_bytecode_file)("rosella/json.pbc", "load");
  25 +}
  26 +
  27 +function main[main]()
  28 +{
  29 + var core = load_packfile("rosella/core.pbc");
  30 + var(Rosella.initialize_rosella)("test");
  31 + using initialize_test;
  32 + var(Rosella.Test.test)(class Test_Rosella_Json_DumpHandler_Hash, initialize_test:[named("initialize")]);
  33 +}
33 t/json/DumpHandler/Integer.t
... ... @@ -0,0 +1,33 @@
  1 +// Automatically generated test for Class Rosella.Json.DumpHandler.Integer
  2 +function create_new(var p_args [slurpy], var n_args [slurpy,named])
  3 +{
  4 + return new Rosella.Json.DumpHandler.Integer;
  5 +}
  6 +
  7 +class Test_Rosella_Json_DumpHandler_Integer
  8 +{
  9 + function can_dump()
  10 + {
  11 + self.status.verify("Test Rosella.Json.DumpHandler.Integer.can_dump()");
  12 + var obj = create_new();
  13 +
  14 + var arg_0 = 1;
  15 + int result = obj.can_dump(arg_0);
  16 + self.assert.is_true(result);
  17 + }
  18 +}
  19 +
  20 +function initialize_test[anon](var context)
  21 +{
  22 + // Set up the test suite here. Set options on the Suite, set up matchers
  23 + // in the matcher factory, load prerequisites, and do other things.
  24 + var(Rosella.load_bytecode_file)("rosella/json.pbc", "load");
  25 +}
  26 +
  27 +function main[main]()
  28 +{
  29 + var core = load_packfile("rosella/core.pbc");
  30 + var(Rosella.initialize_rosella)("test");
  31 + using initialize_test;
  32 + var(Rosella.Test.test)(class Test_Rosella_Json_DumpHandler_Integer, initialize_test:[named("initialize")]);
  33 +}
33 t/json/DumpHandler/Null.t
... ... @@ -0,0 +1,33 @@
  1 +// Automatically generated test for Class Rosella.Json.DumpHandler.Null
  2 +function create_new(var p_args [slurpy], var n_args [slurpy,named])
  3 +{
  4 + return new Rosella.Json.DumpHandler.Null;
  5 +}
  6 +
  7 +class Test_Rosella_Json_DumpHandler_Null
  8 +{
  9 + function can_dump()
  10 + {
  11 + self.status.verify("Test Rosella.Json.DumpHandler.Null.can_dump()");
  12 + var obj = create_new();
  13 +
  14 + var arg_0 = null;
  15 + int result = obj.can_dump(arg_0);
  16 + self.assert.is_true(result);
  17 + }
  18 +}
  19 +
  20 +function initialize_test[anon](var context)
  21 +{
  22 + // Set up the test suite here. Set options on the Suite, set up matchers
  23 + // in the matcher factory, load prerequisites, and do other things.
  24 + var(Rosella.load_bytecode_file)("rosella/json.pbc", "load");
  25 +}
  26 +
  27 +function main[main]()
  28 +{
  29 + var core = load_packfile("rosella/core.pbc");
  30 + var(Rosella.initialize_rosella)("test");
  31 + using initialize_test;
  32 + var(Rosella.Test.test)(class Test_Rosella_Json_DumpHandler_Null, initialize_test:[named("initialize")]);
  33 +}
19 t/json/DumpHandler/Object.t
... ... @@ -0,0 +1,19 @@
  1 +// Automatically generated test for Class Rosella.Json.DumpHandler.Object
  2 +class Test_Rosella_Json_DumpHandler_Object
  3 +{
  4 +}
  5 +
  6 +function initialize_test[anon](var context)
  7 +{
  8 + // Set up the test suite here. Set options on the Suite, set up matchers
  9 + // in the matcher factory, load prerequisites, and do other things.
  10 + var(Rosella.load_bytecode_file)("rosella/json.pbc", "load");
  11 +}
  12 +
  13 +function main[main]()
  14 +{
  15 + var core = load_packfile("rosella/core.pbc");
  16 + var(Rosella.initialize_rosella)("test");
  17 + using initialize_test;
  18 + var(Rosella.Test.test)(class Test_Rosella_Json_DumpHandler_Object, initialize_test:[named("initialize")]);
  19 +}
33 t/json/DumpHandler/String.t
... ... @@ -0,0 +1,33 @@
  1 +// Automatically generated test for Class Rosella.Json.DumpHandler.String
  2 +function create_new(var p_args [slurpy], var n_args [slurpy,named])
  3 +{
  4 + return new Rosella.Json.DumpHandler.String;
  5 +}
  6 +
  7 +class Test_Rosella_Json_DumpHandler_String
  8 +{
  9 + function can_dump()
  10 + {
  11 + self.status.verify("Test Rosella.Json.DumpHandler.String.can_dump()");
  12 + var obj = create_new();
  13 +
  14 + var arg_0 = "test string";
  15 + int result = obj.can_dump(arg_0);
  16 + self.assert.is_true(result);
  17 + }
  18 +}
  19 +
  20 +function initialize_test[anon](var context)
  21 +{
  22 + // Set up the test suite here. Set options on the Suite, set up matchers
  23 + // in the matcher factory, load prerequisites, and do other things.
  24 + var(Rosella.load_bytecode_file)("rosella/json.pbc", "load");
  25 +}
  26 +
  27 +function main[main]()
  28 +{
  29 + var core = load_packfile("rosella/core.pbc");
  30 + var(Rosella.initialize_rosella)("test");
  31 + using initialize_test;
  32 + var(Rosella.Test.test)(class Test_Rosella_Json_DumpHandler_String, initialize_test:[named("initialize")]);
  33 +}
63 t/json/Dumper.t
... ... @@ -0,0 +1,63 @@
  1 +// Automatically generated test for Class Rosella.Json.Dumper
  2 +function create_new(var p_args [slurpy], var n_args [slurpy,named])
  3 +{
  4 + return new Rosella.Json.Dumper(p_args:[flat], n_args:[flat,named]);
  5 +}
  6 +
  7 +class Test_Rosella_Json_Dumper
  8 +{
  9 + function test_new()
  10 + {
  11 + // Test simple constructor. For most individual method tests, use create_new() above
  12 + var obj = new Rosella.Json.Dumper();
  13 + self.assert.not_null(obj);
  14 + self.assert.instance_of(obj, class Rosella.Json.Dumper);
  15 + }
  16 +
  17 + function default_role_dumpers()
  18 + {
  19 + self.status.verify("Test Rosella.Json.Dumper.default_role_dumpers()");
  20 + var obj = create_new();
  21 +
  22 + var result = obj.default_role_dumpers();
  23 + }
  24 +
  25 + function default_misc_dumpers()
  26 + {
  27 + self.status.verify("Test Rosella.Json.Dumper.default_misc_dumpers()");
  28 + var obj = create_new();
  29 +
  30 + var result = obj.default_misc_dumpers();
  31 + }
  32 +
  33 + function default_type_dumpers()
  34 + {
  35 + self.status.verify("Test Rosella.Json.Dumper.default_type_dumpers()");
  36 + var obj = create_new();
  37 +
  38 + var result = obj.default_type_dumpers();
  39 + }
  40 +
  41 + function default_fallback_dumper()
  42 + {
  43 + self.status.verify("Test Rosella.Json.Dumper.default_fallback_dumper()");
  44 + var obj = create_new();
  45 +
  46 + var result = obj.default_fallback_dumper();
  47 + }
  48 +}
  49 +
  50 +function initialize_test[anon](var context)
  51 +{
  52 + // Set up the test suite here. Set options on the Suite, set up matchers
  53 + // in the matcher factory, load prerequisites, and do other things.
  54 + var(Rosella.load_bytecode_file)("rosella/json.pbc", "load");
  55 +}
  56 +
  57 +function main[main]()
  58 +{
  59 + var core = load_packfile("rosella/core.pbc");
  60 + var(Rosella.initialize_rosella)("test");
  61 + using initialize_test;
  62 + var(Rosella.Test.test)(class Test_Rosella_Json_Dumper, initialize_test:[named("initialize")]);
  63 +}
19 t/json/Parser/Rosella.Json.Parser.t
... ... @@ -0,0 +1,19 @@
  1 +// Automatically generated test for NameSpace Rosella.Json.Parser
  2 +class Test_Rosella_Json_Parser
  3 +{
  4 +}
  5 +
  6 +function initialize_test[anon](var context)
  7 +{
  8 + // Set up the test suite here. Initialize the context, set up matchers
  9 + // in the matcher factory, load prerequisites, and do other things.
  10 + var(Rosella.load_bytecode_file)("rosella/json.pbc", "load");
  11 +}
  12 +
  13 +function main[main]()
  14 +{
  15 + var core = load_packfile("rosella/core.pbc");
  16 + var(Rosella.initialize_rosella)("test");
  17 + using initialize_test;
  18 + var(Rosella.Test.test)(class Test_Rosella_Json_Parser, initialize_test:[named("initialize")]);
  19 +}
54 t/json/Rosella.Json.t
... ... @@ -0,0 +1,54 @@
  1 +// Automatically generated test for NameSpace Rosella.Json
  2 +class Test_Rosella_Json
  3 +{
  4 + function to_json()
  5 + {
  6 + self.status.verify("Test Rosella.Json.to_json()");
  7 + self.status.unimplemented("Find a good way to test this");
  8 + using Rosella.Json.to_json;
  9 +
  10 + var arg_0 = null;
  11 + var result = to_json(arg_0);
  12 + }
  13 +
  14 + function parse()
  15 + {
  16 + self.status.verify("Test Rosella.Json.parse()");
  17 + using Rosella.Json.parse;
  18 +
  19 + string arg_0 = "{'foo' : 1, 'bar' : 2, 'baz' : 3, 'fie': [4, 5, true, false, null]}";
  20 + var result = parse(arg_0);
  21 + self.assert.equal(elements(result), 4);
  22 + self.assert.equal(result["foo"], 1);
  23 + self.assert.equal(result["bar"], 2);
  24 + self.assert.equal(result["baz"], 3);
  25 + self.assert.equal(result["fie"][0], 4);
  26 + self.assert.equal(result["fie"][1], 5);
  27 + self.assert.equal(result["fie"][2], true);
  28 + self.assert.equal(result["fie"][3], false);
  29 + self.assert.is_null(result["fie"][4]);
  30 + }
  31 +
  32 + function default_builder_factory()
  33 + {
  34 + self.status.verify("Test Rosella.Json.default_builder_factory()");
  35 + using Rosella.Json.default_builder_factory;
  36 + var result = default_builder_factory();
  37 + self.assert.not_null(result);
  38 + }
  39 +}
  40 +
  41 +function initialize_test[anon](var context)
  42 +{
  43 + // Set up the test suite here. Initialize the context, set up matchers
  44 + // in the matcher factory, load prerequisites, and do other things.
  45 + var(Rosella.load_bytecode_file)("rosella/json.pbc", "load");
  46 +}
  47 +
  48 +function main[main]()
  49 +{
  50 + var core = load_packfile("rosella/core.pbc");
  51 + var(Rosella.initialize_rosella)("test");
  52 + using initialize_test;
  53 + var(Rosella.Test.test)(class Test_Rosella_Json, initialize_test:[named("initialize")]);
  54 +}

No commit comments for this range

Something went wrong with that request. Please try again.