v / cmd / tools / vdoc / testdata / output_formats / main.v
79 lines · 63 sloc · 1.79 KB · 8eaaba6094456bb21833fddf20d22514e7dadcb2
Raw
1pub const omega = 3 // should be first
2
3pub const alpha = 5 // should be in the middle
4
5pub const beta = 2 // should be at the end
6
7// def - should be first
8pub fn def() {
9 println(1)
10}
11
12// xyz - should be in the middle
13// a small script <script>console.log('hello');</script>
14// bold text <b>bold</b> end
15// underlined text <u>underline</u> end
16// a link [main v repo](https://github.com/vlang/v)
17pub fn xyz() {
18 println(2)
19}
20
21// abc - should be last
22pub fn abc() {
23 println(3)
24}
25
26// MyXMLDocument is here just to test the different combinations of methods/output types
27pub struct MyXMLDocument {
28 path string
29}
30
31// MyXMLDocument.from_text processes the file path, and returns an error
32pub fn MyXMLDocument.from_file(path string) !MyXMLDocument {
33 return error('TODO')
34}
35
36// MyXMLDocument.from_text processes text and produces none
37pub fn MyXMLDocument.from_text(text string) ?MyXMLDocument {
38 return none
39}
40
41// MyXMLDocument.abc does something too... I just do not know what.
42pub fn MyXMLDocument.abc(text string) ?(string, int) {
43 return 'xyz', 123
44}
45
46// instance_from_file does stuff with path
47pub fn (x &MyXMLDocument) instance_from_file(path string) !MyXMLDocument {
48 return error('TODO')
49}
50
51// instance_from_text does stuff with text
52pub fn (x &MyXMLDocument) instance_from_text(text string) ?MyXMLDocument {
53 return none
54}
55
56// instance_abc does stuff too
57pub fn (x &MyXMLDocument) instance_abc(text string) ?(string, int) {
58 return 'xyz', 123
59}
60
61// instance_void does stuff too
62pub fn (x &MyXMLDocument) instance_void() {
63 return 123
64}
65
66// instance_int does stuff too
67pub fn (x &MyXMLDocument) instance_int() int {
68 return 123
69}
70
71// instance_error does stuff too
72pub fn (x &MyXMLDocument) instance_result() ! {
73 return 123
74}
75
76// instance_option does stuff too
77pub fn (x &MyXMLDocument) instance_option() ? {
78 return 123
79}
80