From 8a96d2abcbc2ac35a876247db08bd7c03be4f9bc Mon Sep 17 00:00:00 2001 From: Marius Andra Date: Thu, 20 Jun 2024 12:03:14 +0200 Subject: [PATCH] few more tests --- hogvm/__tests__/__snapshots__/tuples.hoge | 12 ++++++------ hogvm/__tests__/__snapshots__/tuples.stdout | 1 + hogvm/__tests__/arrays.hog | 10 +++++----- hogvm/__tests__/dicts.hog | 4 ++-- hogvm/__tests__/tuples.hog | 3 ++- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/hogvm/__tests__/__snapshots__/tuples.hoge b/hogvm/__tests__/__snapshots__/tuples.hoge index 093935a01df37..a7c568e742d6a 100644 --- a/hogvm/__tests__/__snapshots__/tuples.hoge +++ b/hogvm/__tests__/__snapshots__/tuples.hoge @@ -1,7 +1,7 @@ ["_h", 2, "tuple", 0, 2, "print", 1, 35, 33, 1, 44, 1, 2, "print", 1, 35, 33, 1, 33, 2, 44, 2, 2, "print", 1, 35, 33, 1, -33, 2, 33, 3, 44, 3, 2, "print", 1, 35, 33, 1, 32, "2", 33, 3, 44, 3, 2, "print", 1, 35, 33, 1, 33, 2, 33, 3, 44, 2, 33, -4, 44, 3, 2, "print", 1, 35, 33, 1, 33, 2, 33, 3, 33, 4, 44, 2, 44, 2, 33, 5, 44, 3, 2, "print", 1, 35, 33, 1, 33, 2, -33, 3, 44, 3, 36, 0, 33, 1, 45, 2, "print", 1, 35, 33, 1, 33, 2, 33, 3, 33, 4, 44, 2, 44, 2, 33, 5, 44, 3, 33, 1, 45, -33, 1, 45, 33, 1, 45, 2, "print", 1, 35, 33, 1, 33, 2, 33, 3, 33, 4, 44, 2, 44, 2, 33, 5, 44, 3, 33, 1, 45, 33, 1, 45, -33, 1, 45, 2, "print", 1, 35, 33, 1, 33, 1, 33, 2, 33, 3, 33, 4, 44, 2, 44, 2, 33, 5, 44, 3, 33, 1, 45, 33, 1, 45, 33, -1, 45, 6, 2, "print", 1, 35, 35] +33, 2, 44, 2, 2, "print", 1, 35, 33, 1, 33, 2, 33, 3, 44, 3, 2, "print", 1, 35, 33, 1, 32, "2", 33, 3, 44, 3, 2, +"print", 1, 35, 33, 1, 33, 2, 33, 3, 44, 2, 33, 4, 44, 3, 2, "print", 1, 35, 33, 1, 33, 2, 33, 3, 33, 4, 44, 2, 44, 2, +33, 5, 44, 3, 2, "print", 1, 35, 33, 1, 33, 2, 33, 3, 44, 3, 36, 0, 33, 1, 45, 2, "print", 1, 35, 33, 1, 33, 2, 33, 3, +33, 4, 44, 2, 44, 2, 33, 5, 44, 3, 33, 1, 45, 33, 1, 45, 33, 1, 45, 2, "print", 1, 35, 33, 1, 33, 2, 33, 3, 33, 4, 44, +2, 44, 2, 33, 5, 44, 3, 33, 1, 45, 33, 1, 45, 33, 1, 45, 2, "print", 1, 35, 33, 1, 33, 1, 33, 2, 33, 3, 33, 4, 44, 2, +44, 2, 33, 5, 44, 3, 33, 1, 45, 33, 1, 45, 33, 1, 45, 6, 2, "print", 1, 35, 35] diff --git a/hogvm/__tests__/__snapshots__/tuples.stdout b/hogvm/__tests__/__snapshots__/tuples.stdout index 7a8df8236d73a..e242b464eab6a 100644 --- a/hogvm/__tests__/__snapshots__/tuples.stdout +++ b/hogvm/__tests__/__snapshots__/tuples.stdout @@ -1,6 +1,7 @@ tuple() tuple(1) (1, 2) +(1, 2) (1, 2, 3) (1, '2', 3) (1, (2, 3), 4) diff --git a/hogvm/__tests__/arrays.hog b/hogvm/__tests__/arrays.hog index af6f0c81decd8..d01e0896df1f1 100644 --- a/hogvm/__tests__/arrays.hog +++ b/hogvm/__tests__/arrays.hog @@ -1,12 +1,12 @@ print([]) print([1, 2, 3]) -print([1, '2', 3]) +print([1, '2', 3, ]) print([1, [2, 3], 4]) print([1, [2, [3, 4]], 5]) let a := [1, 2, 3] -print(a[1]) -print([1, 2, 3][1]) -print([1, [2, [3, 4]], 5][1][1][1]) +print(a[1], ) +print([1, 2, 3][1], ) +print([1, [2, [3, 4], ], 5][1][1][1]) print([1, [2, [3, 4]], 5][1][1][1] + 1) -print([1, [2, [3, 4]], 5].1.1.1) +print([1, [2, [3, 4, ], ], 5, ].1.1.1) diff --git a/hogvm/__tests__/dicts.hog b/hogvm/__tests__/dicts.hog index c1cdf03fbef81..ccd081190b0da 100644 --- a/hogvm/__tests__/dicts.hog +++ b/hogvm/__tests__/dicts.hog @@ -7,7 +7,7 @@ print({key: 'value'}) let key := 3 print({key: 'value'}) -print({'key': 'value'}.key) +print({'key': 'value', }.key) print({'key': 'value'}['key']) print({'key': {'otherKey': 'value'}}.key.otherKey) -print({'key': {'otherKey': 'value'}}['key'].otherKey) +print({'key': {'otherKey': 'value', } , }['key'].otherKey) diff --git a/hogvm/__tests__/tuples.hog b/hogvm/__tests__/tuples.hog index f1f2ac52839ef..7932a68531b37 100644 --- a/hogvm/__tests__/tuples.hog +++ b/hogvm/__tests__/tuples.hog @@ -1,6 +1,7 @@ print(tuple()) print((1,)) print((1, 2)) +print((1, 2,)) print((1, 2, 3)) print((1, '2', 3)) print((1, (2, 3), 4)) @@ -8,5 +9,5 @@ print((1, (2, (3, 4)), 5)) let a := (1, 2, 3) print(a[1]) print((1, (2, (3, 4)), 5)[1][1][1]) -print((1, (2, (3, 4)), 5).1.1.1) +print((1, (2, (3, 4, ), ), 5, ).1.1.1) print((1, (2, (3, 4)), 5)[1][1][1] + 1)