v2 / vlib / v / fmt / tests / attrs_keep.vv
36 lines · 30 sloc · 702 bytes · 3ffc951cf555dc4818309a507ccb9d0da4de748f
Raw
1struct AttrsWithEscapedStringArgs {
2 dollar string @[foo: '\$var']
3 double_bs string @[bar: '\\baz']
4}
5
6@[deprecated: 'use bar() instead']
7@[foo: bar]
8@[if debug; inline]
9fn keep_attributes() {
10 println('hi !')
11}
12
13@[bar: 'foo']
14fn attr_with_arg() {}
15
16@['a_string_name']
17fn name_only_attr() {}
18
19struct User {
20 age int
21 nums []int
22 last_name string @[json: lastName]
23 is_registered bool @[json: IsRegistered]
24 typ int @[json: 'type']
25 pets string @[json: 'pet_animals'; raw]
26}
27
28@[_allow_multiple_values]
29enum Example {
30 value1 = 1
31 value1_again = 1
32}
33
34@[deprecated: 'use Example instead']
35@[deprecated_after: '2040-01-24']
36pub type Alias = Example
37