aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/vlib/v/tests/module_test.v
blob: bb4ba72242df2085e4b7236f38e1ed4ca1926d2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
import crypto.sha256
import term { white }
import crypto.md5 { sum }
import log as l
import time as t { Time, utc }
import math
import crypto.sha512
import cli { Command }

struct TestAliasInStruct {
	time Time
}

fn test_import() {
	info := l.Level.info
	assert info == .info
	assert white('INFO') == white('INFO')
	assert os.o_rdonly == os.o_rdonly
	assert t.month_days[0] == t.month_days[0]
	assert sha256.size == sha256.size
	assert math.pi == math.pi
	assert sha512.size == sha512.size
	assert sum('module'.bytes()).hex() == sum('module'.bytes()).hex()
	assert utc().unix_time() == utc().unix_time()
}

fn test_imports_array_as_fn_arg() {
	mut cmd := Command{
		name: 'module test'
	}
	c1 := Command{}
	c2 := Command{
		name: 'cmd2'
	}
	cmd.add_commands([c1, c2])
}

fn test_alias_in_struct_field() {
	a := TestAliasInStruct{
		time: Time{
			year: 2020
		}
	}
	assert a.time.year == 2020
}