Skip to content

Commit

Permalink
tests: improve aliasing tests for strict type aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Feb 8, 2025
1 parent bcb1934 commit e5fd70d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/aliasing/chan.jule
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2025 The Jule Programming Language.
// Use of this source code is governed by a BSD 3-Clause
// license that can be found in the LICENSE file.

type Chan: chan int

impl Bla2 for Chan {
fn foo2(self) {
i := <-self
if i != 90 {
panic("expected 90")
}
}
}

fn init() {
a := make(Chan, 1)
a <- 90
m := Bla2(a)
m.foo2()
}
22 changes: 22 additions & 0 deletions tests/aliasing/map.jule
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2025 The Jule Programming Language.
// Use of this source code is governed by a BSD 3-Clause
// license that can be found in the LICENSE file.

use "std/fmt"

type Map: map[int]str

impl Bla2 for Map {
fn foo2(self) {
s := fmt::Format("{}", self)
if s != "{}" {
panic("expected {}")
}
}
}

fn init() {
a := Map{}
m := Bla2(a)
m.foo2()
}

0 comments on commit e5fd70d

Please sign in to comment.