Skip to content

Commit e04039c

Browse files
committed
Expanded tests to cover new cases.
1 parent 7e4f615 commit e04039c

File tree

10 files changed

+115
-2
lines changed

10 files changed

+115
-2
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
a:BoolValue:true
2+
b:BoolValue:false
3+
a_1:BoolValue:false
4+
a_2:BoolValue:true
5+
a_3:BoolValue:false
6+
b_1:BoolValue:true
7+
b_2:BoolValue:false
8+
b_3:BoolValue:false
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
a = true;
2+
b = false;
3+
4+
a_1 = a.not(); // false
5+
a_2 = a.and(true); // true
6+
a_3 = a.and(false); // false
7+
8+
b_1 = b.not(); // true
9+
b_2 = b.and(true); // false
10+
b_3 = b.and(false); // false
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
a:StringValue:"79c2b46ce2594ecbcb5b73e928345492"
2+
b:StringValue:"d41d8cd98f00b204e9800998ecf8427e"
3+
c:StringValue:"3f3b08eca62c21d76256e6e1d0b8bf99f4efbe376f64335b72f4163a8fc50dba"
4+
d:StringValue:"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
5+
e:StringValue:"cfcd208495d565ef66e7dff9f98764da"
6+
f:StringValue:"c4ca4238a0b923820dcc509a6f75849b"
7+
EX:Smuuf\Primi\ErrorException
8+
EX:Smuuf\Primi\ErrorException
9+
EX:Smuuf\Primi\ErrorException
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// pragma:one_liners
2+
a = hash_md5("ahoj");
3+
b = hash_md5("");
4+
c = hash_sha256("ahoj");
5+
d = hash_sha256("");
6+
7+
e = hash_md5(0);
8+
f = hash_md5(1);
9+
10+
_ex = hash_sha256([]);
11+
_ex = hash_sha256(true);
12+
_ex = hash_sha256(null);

tests/language/suites/extensions/ext.string.expect

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ k:StringValue:"1 2 3"
1212
l:BoolValue:true
1313
m:BoolValue:true
1414
n:BoolValue:false
15+
o:StringValue:"1,2,3"
16+
p:StringValue:"1,nested,stuff-yeah,3"

tests/language/suites/extensions/ext.string.primi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@ j = "{} can now {} strings, {} rascal!".format("you", "format", "you");
1818
k = "{3} {2} {1}".format(3, "2", 1);
1919

2020
l = "if you have a one gigawatt coal plant, you need an eighty car train full of coal every day to provide fuel.".contains("gigawatt");
21-
m = "ahoj ahoj ahoj!".contains(r"(ahoj ){2}!?")
22-
n = "ahoj ahoj ahoj!".contains(r"(čau ){2}!?")
21+
m = "ahoj ahoj ahoj!".contains(r"(ahoj ){2}!?");
22+
n = "ahoj ahoj ahoj!".contains(r"(čau ){2}!?");
23+
24+
o = ",".join([1, 2, 3]);
25+
p = ",".join([1, ['nested', "stuff-{}".format("yeah")], 3]);

tests/language/suites/operations/casting.expect

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
type_string_null:StringValue:"null"
2+
type_string_boolA:StringValue:"bool"
3+
type_string_boolB:StringValue:"bool"
4+
type_string_numberA:StringValue:"number"
5+
type_string_numberB:StringValue:"number"
6+
type_string_numberC:StringValue:"number"
7+
type_string_stringA:StringValue:"string"
8+
type_string_stringB:StringValue:"string"
9+
type_string_regexA:StringValue:"regex"
10+
type_string_regexB:StringValue:"regex"
11+
type_string_regexC:StringValue:"regex"
12+
type_string_function:StringValue:"function"
13+
type_string_arrayA:StringValue:"array"
14+
type_string_arrayB:StringValue:"array"
115
x_number_to_number:NumberValue:1
216
x_number_to_string:StringValue:"1"
317
x_number_to_bool:BoolValue:true

tests/language/suites/operations/casting.primi

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
// pragma:one_liners
2+
type_string_null = type(null) // "null"
3+
type_string_boolA = type(true) // "bool"
4+
type_string_boolB = type(false) // "bool"
5+
type_string_numberA = type(1) // "number"
6+
type_string_numberB = type(-1) // "number"
7+
type_string_numberC = type(0.123) // "number"
8+
type_string_stringA = type("") // "string"
9+
type_string_stringB = type("ahoj") // "string"
10+
type_string_regexA = type(r"ahoj") // "regex"
11+
type_string_regexB = type(r"a[ho]j") // "regex"
12+
type_string_regexC = type(r"") // "regex"
13+
type_string_function = type(type) // "function"
14+
type_string_arrayA = type([]) // "array"
15+
type_string_arrayB = type([1,2,'c']) // "array"
16+
217
x_number_to_number = 1.to_number() // 1
318
x_number_to_string = 1.to_string() // "1"
419
x_number_to_bool = 1.to_bool() // true
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
EX:Smuuf\Primi\ErrorException
2+
EX:Smuuf\Primi\ErrorException
3+
EX:Smuuf\Primi\ErrorException
4+
EX:Smuuf\Primi\ErrorException
5+
EX:Smuuf\Primi\ErrorException
6+
EX:Smuuf\Primi\ErrorException
7+
EX:Smuuf\Primi\ErrorException
8+
EX:Smuuf\Primi\ErrorException
9+
EX:Smuuf\Primi\ErrorException
10+
EX:Smuuf\Primi\ErrorException
11+
EX:Smuuf\Primi\ErrorException
12+
EX:Smuuf\Primi\ErrorException
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// pragma:one_liners
2+
3+
// Cannot insert arrays into strings.
4+
_tmp = "ahoj"; _tmp[999] = []
5+
// Cannot insert arrays into numbers.
6+
_tmp = 123; _tmp[999] = []
7+
// Cannot insert arrays into bools.
8+
_tmp = true; _tmp[999] = []
9+
// Cannot insert arrays into regexes.
10+
_tmp = r"abc"; _tmp[999] = []
11+
12+
// Cannot insert nulls into strings.
13+
_tmp = "ahoj"; _tmp[999] = null
14+
// Cannot insert nulls into numbers.
15+
_tmp = 123; _tmp[999] = null
16+
// Cannot insert nulls into bools.
17+
_tmp = true; _tmp[999] = null
18+
// Cannot insert nulls into regexes.
19+
_tmp = r"abc"; _tmp[999] = null
20+
21+
// Cannot insert bools into strings.
22+
_tmp = "ahoj"; _tmp[999] = true
23+
// Cannot insert nulls into numbers.
24+
_tmp = 123; _tmp[999] = true
25+
// Cannot insert nulls into bools.
26+
_tmp = true; _tmp[999] = true
27+
// Cannot insert nulls into regexes.
28+
_tmp = r"abc"; _tmp[999] = true

0 commit comments

Comments
 (0)