v2 / vlib / v / tests / attribute_test.v
55 lines · 46 sloc · 700 bytes · 757929392e0e7a75fc1272116460981e589737d5
Raw
1@[testing]
2struct StructAttrTest {
3 foo string
4 bar int
5}
6
7@[testing]
8pub struct PubStructAttrTest {
9 foo string
10 bar int
11}
12
13struct StructFieldAttrTest {
14 foo string @[attr: bar; attr0; attr1: 'foo']
15 bar int @[attr0: 123; attr1: true; attr2: false]
16 baz bool = true @[prefix.attr0]
17}
18
19@[testing]
20enum EnumAttrTest {
21 one
22 two
23}
24
25@[testing]
26pub enum PubEnumAttrTest {
27 one
28 two
29}
30
31@[attrone; attrtwo]
32pub enum EnumMultiAttrTest {
33 one
34 two
35}
36
37@[testing]
38fn test_fn_attribute() {
39 assert true
40}
41
42@[testing]
43pub fn test_pub_fn_attribute() {
44 assert true
45}
46
47@[attrone; attrtwo]
48fn test_fn_multi_attribute() {
49 assert true
50}
51
52@[attrone; attrtwo]
53fn test_fn_multi_attribute_single() {
54 assert true
55}
56