From 967b649da20f1cb2011025456853cb55f25e9a88 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 18 Aug 2024 20:39:57 -0400 Subject: Deprecate `#` operator in favor of .length and fix up some issues --- test/arrays.tm | 6 +++--- test/iterators.tm | 2 +- test/nums.tm | 3 --- test/tables.tm | 4 ++-- test/text.tm | 4 ---- 5 files changed, 6 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/arrays.tm b/test/arrays.tm index 76507c5b..ac243018 100644 --- a/test/arrays.tm +++ b/test/arrays.tm @@ -12,7 +12,7 @@ func main(): >> arr[-1] = 30 - >> #arr + >> arr.length = 3 sum := 0 @@ -105,7 +105,7 @@ func main(): >> heap:heapify() >> heap sorted := [:Int] - while #heap > 0: + while heap.length > 0: sorted:insert(heap:heap_pop()) >> sorted == sorted:sorted() = yes @@ -113,7 +113,7 @@ func main(): heap:heap_push(Int.random(1, 50)) >> heap sorted = [:Int] - while #heap > 0: + while heap.length > 0: sorted:insert(heap:heap_pop()) >> sorted == sorted:sorted() = yes diff --git a/test/iterators.tm b/test/iterators.tm index 1f7ce342..0a2d2818 100644 --- a/test/iterators.tm +++ b/test/iterators.tm @@ -3,7 +3,7 @@ enum PairIteration(Done, Next(x:Text, y:Text)) func pairwise(strs:[Text])->func()->PairIteration: i := 1 return func(): - if i + 1 > #strs: return PairIteration.Done + if i + 1 > strs.length: return PairIteration.Done i += 1 return PairIteration.Next(strs[i-1], strs[i]) diff --git a/test/nums.tm b/test/nums.tm index 94959744..48693f0e 100644 --- a/test/nums.tm +++ b/test/nums.tm @@ -37,9 +37,6 @@ func main(): >> Num.PI:sin():near(0) = yes - >> 10.0:pow(3) - = 1000 - >> Num.nan():near(Num.nan()) = no diff --git a/test/tables.tm b/test/tables.tm index 7f8383d8..7b3595b6 100644 --- a/test/tables.tm +++ b/test/tables.tm @@ -15,7 +15,7 @@ func main(): >> t_str = "(one:1)(two:2)" - >> #t + >> t.length = 2 >> t.fallback = !{Text:Int} @@ -35,7 +35,7 @@ func main(): >> t2:get("???", 999) = 999 - >> #t2 + >> t2.length = 1 >> t2.fallback = @%{"one":1, "two":2}? diff --git a/test/text.tm b/test/text.tm index 2666b6c8..ce8ed43f 100644 --- a/test/text.tm +++ b/test/text.tm @@ -26,8 +26,6 @@ func main(): = [65_i32, 109_i32, 101_i32, 769_i32, 108_i32, 105_i32, 101_i32] : [Int32] >> amelie:bytes() = [65_i8, 109_i8, 101_i8, -52_i8, -127_i8, 108_i8, 105_i8, 101_i8] : [Int8] - >> #amelie - = 6 >> amelie:num_clusters() = 6 >> amelie:num_codepoints() @@ -42,8 +40,6 @@ func main(): = [65_i32, 109_i32, 101_i32, 769_i32, 108_i32, 105_i32, 101_i32] : [Int32] >> amelie2:bytes() = [65_i8, 109_i8, 101_i8, -52_i8, -127_i8, 108_i8, 105_i8, 101_i8] : [Int8] - >> #amelie - = 6 >> amelie2:num_clusters() = 6 >> amelie2:num_codepoints() -- cgit v1.2.3