Skip to content

Commit

Permalink
tests: Rename ignored test
Browse files Browse the repository at this point in the history
  • Loading branch information
dinfuehr committed Jan 25, 2025
1 parent 2068641 commit e541609
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 39 deletions.
60 changes: 60 additions & 0 deletions tests/trait/trait-default-wip.dora
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//= ignore

trait MyIterator {
type Item;
fn next(): Option[Self::Item];

fn count(): Int64 {
let mut result = 0;

while self.next() is Some(_) {
result += 1;
}

result
}

fn enumerate(): Enumerate[Self] {
Enumerate[Self](it = self, idx = 0)
}
}

class Range {
value: Int
}

impl MyIterator for Range {
fn next(): Option[Int] {
if self.value <= 0 {
None[Int]
} else {
let result = self.value;
self.value -= 1;
Some[Int](result)
}
}
}

class Enumerate[I: MyIterator] {
it: I,
idx: Int,
}

// impl[I: MyIterator] MyIterator for Enumerate[I] {
// type Item = (Int, [I as MyIterator]::Item);

// fn next(): Option[(Int, [I as MyIterator]::Item)] {
// if self.it.next() is Some(value) {
// let idx = self.idx;
// self.idx += 1;
// Some((idx, value))
// } else {
// None
// }
// }
// }

fn main() {
assert(Range(2).count() == 2);
assert(Range(7).count() == 7);
}
39 changes: 0 additions & 39 deletions tests/trait/trait-default3.dora

This file was deleted.

0 comments on commit e541609

Please sign in to comment.