Skip to content

Commit

Permalink
tests: fix invalid tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kindlich committed Aug 17, 2024
1 parent 99bd929 commit c40eabb
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#output: B
#output: C
#error: 11:UNDEFINED_VARIABLE

public enum MyEnum {
A, B, C;

this(){}
}

val x: MyEnum = B;
val y: MyEnum;
var x: MyEnum = B;
var y: MyEnum;
y = G;
println(x.name);
println(y.name);
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
#output: 5
#output: 5
#output: 5
#output: 5

// One of the tests required to make StdLib (Arrays.zs) work
public expand <T> T[] {
public map<U>(projection as function(value as T) as U) as U[] {
var result = new U[](this.length);
for i in 0 .. this.length {
result[i] = projection(this[i]);
}
return result;
}
return new U[](length, i => projection(this[i]));
}
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#output: ========
#output: a
#output: ========

function test(args...: string) {
println(args.join(','));
function test(args...: string[]): void {
for item in args println(item);
}

println("========");
test("a");
println("========");
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#output: a,b
#output: ========
#output: a
#output: b
#output: ========

function test(args...: string) {
println(args.join(','));
function test(args...: string[]): void {
for item in args println(item);
}

println("========");
test("a", "b");
println("========");
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#output:
#output: ========
#output: ========

function test(args...: string) {
println(args.join(','));
function test(args...: string[]): void {
for item in args println(item);
}

println("========");
test();
println("========");

0 comments on commit c40eabb

Please sign in to comment.