nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge: Basename fix
[nit.git]
/
tests
/
test_serialization.nit
diff --git
a/tests/test_serialization.nit
b/tests/test_serialization.nit
index
b6a5bbc
..
75c7a9d
100644
(file)
--- a/
tests/test_serialization.nit
+++ b/
tests/test_serialization.nit
@@
-14,21
+14,25
@@
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+#alt2#module test_serialization_alt2 is serialize
+
import serialization
import serialization
-import json_serialization
+import json::serialization
# Simple class
class A
# Simple class
class A
- auto_serializable
- super Serializable
-
- var b: Bool
- var c: Char
- var f: Float
- var i: Int
- var s: String
+ serialize
+#alt5# serialize
+
+ var b = false
+ var c: Char#alt2#
+ #alt2#var c: Char is noserialize
+ var f: Float#alt4#
+ #alt4#var f: Float is serialize
+ var i = 123
+ var s = "asdf"
var n: nullable Int
var n: nullable Int
- var array: Array[nullable Object] = new Array[nullable Object].with_items(88, "hello", null)
+ var array = new Array[nullable Object].with_items(88, "hello", null)
init(b: Bool, c: Char, f: Float, i: Int, s: String, n: nullable Int)
do
init(b: Bool, c: Char, f: Float, i: Int, s: String, n: nullable Int)
do
@@
-44,7
+48,9
@@
end
# Sub-class of A
class B
# Sub-class of A
class B
- auto_serializable
+ auto_serializable#alt2##alt3#
+#alt2# noserialize
+#alt3# noserialize
super A
var ii: Int
super A
var ii: Int
@@
-64,10
+70,9
@@
end
# Composed of an A and a B
class C
auto_serializable
# Composed of an A and a B
class C
auto_serializable
- super Serializable
var a: A
var a: A
- var b: B
+ var b = new B(false, 'b', 123.123, 2345, "hjkl", 12, 1111, "qwer")
var aa: A
init(a: A, b: B)
var aa: A
init(a: A, b: B)
@@
-97,8
+102,9
@@
var d = new D(false, 'b', 123.123, 2345, "new line ->\n<-", null, 1111, "\t\f\"\
d.d = d
for o in new Array[Serializable].with_items(a, b, c, d) do
d.d = d
for o in new Array[Serializable].with_items(a, b, c, d) do
- var stream = new StringOStream
+ var stream = new StringWriter
var serializer = new JsonSerializer(stream)
var serializer = new JsonSerializer(stream)
+ #alt1#serializer.plain_json = true
serializer.serialize(o)
print "# Nit:\n{o}\n"
serializer.serialize(o)
print "# Nit:\n{o}\n"