| 1 | import os |
| 2 | import crypto.sha256 |
| 3 | import term { white } |
| 4 | import crypto.md5 { sum } |
| 5 | import log as l |
| 6 | import time as t { Time, utc } |
| 7 | import math |
| 8 | import crypto.sha512 |
| 9 | import cli { Command } |
| 10 | |
| 11 | struct TestAliasInStruct { |
| 12 | time Time |
| 13 | } |
| 14 | |
| 15 | fn test_import() { |
| 16 | info := l.Level.info |
| 17 | assert info == .info |
| 18 | assert white('INFO') == white('INFO') |
| 19 | assert os.o_rdonly == os.o_rdonly |
| 20 | assert t.month_days[0] == t.month_days[0] |
| 21 | assert sha256.size == sha256.size |
| 22 | assert math.pi == math.pi |
| 23 | assert sha512.size == sha512.size |
| 24 | assert sum('module'.bytes()).hex() == sum('module'.bytes()).hex() |
| 25 | assert utc().unix() == utc().unix() |
| 26 | } |
| 27 | |
| 28 | fn test_imports_array_as_fn_arg() { |
| 29 | mut cmd := Command{ |
| 30 | name: 'module test' |
| 31 | } |
| 32 | c1 := Command{} |
| 33 | c2 := Command{ |
| 34 | name: 'cmd2' |
| 35 | } |
| 36 | cmd.add_commands([c1, c2]) |
| 37 | } |
| 38 | |
| 39 | fn test_alias_in_struct_field() { |
| 40 | a := TestAliasInStruct{ |
| 41 | time: Time{ |
| 42 | year: 2020 |
| 43 | } |
| 44 | } |
| 45 | assert a.time.year == 2020 |
| 46 | } |
| 47 | |