aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/cmd/tools/vvet/tests
diff options
context:
space:
mode:
authorIndrajith K L2022-12-03 17:00:20 +0530
committerIndrajith K L2022-12-03 17:00:20 +0530
commitf5c4671bfbad96bf346bd7e9a21fc4317b4959df (patch)
tree2764fc62da58f2ba8da7ed341643fc359873142f /v_windows/v/old/cmd/tools/vvet/tests
downloadcli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.tar.gz
cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.tar.bz2
cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.zip
Adds most of the toolsHEADmaster
Diffstat (limited to 'v_windows/v/old/cmd/tools/vvet/tests')
-rw-r--r--v_windows/v/old/cmd/tools/vvet/tests/array_init_one_val.out2
-rw-r--r--v_windows/v/old/cmd/tools/vvet/tests/array_init_one_val.vv5
-rw-r--r--v_windows/v/old/cmd/tools/vvet/tests/indent_with_space.out6
-rw-r--r--v_windows/v/old/cmd/tools/vvet/tests/indent_with_space.vv24
-rw-r--r--v_windows/v/old/cmd/tools/vvet/tests/module_file_test.out5
-rw-r--r--v_windows/v/old/cmd/tools/vvet/tests/module_file_test.vv55
-rw-r--r--v_windows/v/old/cmd/tools/vvet/tests/parens_space_a.out2
-rw-r--r--v_windows/v/old/cmd/tools/vvet/tests/parens_space_a.vv4
-rw-r--r--v_windows/v/old/cmd/tools/vvet/tests/parens_space_b.out2
-rw-r--r--v_windows/v/old/cmd/tools/vvet/tests/parens_space_b.vv4
-rw-r--r--v_windows/v/old/cmd/tools/vvet/tests/trailing_space.out7
-rw-r--r--v_windows/v/old/cmd/tools/vvet/tests/trailing_space.vv16
12 files changed, 132 insertions, 0 deletions
diff --git a/v_windows/v/old/cmd/tools/vvet/tests/array_init_one_val.out b/v_windows/v/old/cmd/tools/vvet/tests/array_init_one_val.out
new file mode 100644
index 0000000..e10d511
--- /dev/null
+++ b/v_windows/v/old/cmd/tools/vvet/tests/array_init_one_val.out
@@ -0,0 +1,2 @@
+cmd/tools/vvet/tests/array_init_one_val.vv:2: error: Use `var == value` instead of `var in [value]`
+NB: You can run `v fmt -w file.v` to fix these errors automatically
diff --git a/v_windows/v/old/cmd/tools/vvet/tests/array_init_one_val.vv b/v_windows/v/old/cmd/tools/vvet/tests/array_init_one_val.vv
new file mode 100644
index 0000000..2aa3514
--- /dev/null
+++ b/v_windows/v/old/cmd/tools/vvet/tests/array_init_one_val.vv
@@ -0,0 +1,5 @@
+fn main() {
+ if 1 in [1] {
+ println('hello world')
+ }
+}
diff --git a/v_windows/v/old/cmd/tools/vvet/tests/indent_with_space.out b/v_windows/v/old/cmd/tools/vvet/tests/indent_with_space.out
new file mode 100644
index 0000000..b307e20
--- /dev/null
+++ b/v_windows/v/old/cmd/tools/vvet/tests/indent_with_space.out
@@ -0,0 +1,6 @@
+cmd/tools/vvet/tests/indent_with_space.vv:2: error: Looks like you are using spaces for indentation.
+cmd/tools/vvet/tests/indent_with_space.vv:10: error: Looks like you are using spaces for indentation.
+cmd/tools/vvet/tests/indent_with_space.vv:17: error: Looks like you are using spaces for indentation.
+cmd/tools/vvet/tests/indent_with_space.vv:20: error: Looks like you are using spaces for indentation.
+cmd/tools/vvet/tests/indent_with_space.vv:22: error: Looks like you are using spaces for indentation.
+NB: You can run `v fmt -w file.v` to fix these errors automatically
diff --git a/v_windows/v/old/cmd/tools/vvet/tests/indent_with_space.vv b/v_windows/v/old/cmd/tools/vvet/tests/indent_with_space.vv
new file mode 100644
index 0000000..9b466ef
--- /dev/null
+++ b/v_windows/v/old/cmd/tools/vvet/tests/indent_with_space.vv
@@ -0,0 +1,24 @@
+fn main() {
+ _ = 1 == 2
+}
+
+fn block_comments() {
+ /* tab to indent the comment
+ spaces before
+ also spaces before
+ same here */
+ /* spaces for comment indentation (ouch)
+ and inside too
+ */
+}
+
+fn space_inside_strings() {
+ // Plain strings
+ str := "Bad space usage for variable indentation.
+ Here it's fine.
+ Here too."
+ str2 := 'linebreak and space\n inside'
+ // String interpolation
+ si1 := 'Error here $foo
+ and not here'
+}
diff --git a/v_windows/v/old/cmd/tools/vvet/tests/module_file_test.out b/v_windows/v/old/cmd/tools/vvet/tests/module_file_test.out
new file mode 100644
index 0000000..b033e71
--- /dev/null
+++ b/v_windows/v/old/cmd/tools/vvet/tests/module_file_test.out
@@ -0,0 +1,5 @@
+cmd/tools/vvet/tests/module_file_test.vv:7: warning: Function documentation seems to be missing for "pub fn foo() string".
+cmd/tools/vvet/tests/module_file_test.vv:13: warning: A function name is missing from the documentation of "pub fn bar() string".
+cmd/tools/vvet/tests/module_file_test.vv:35: warning: Function documentation seems to be missing for "pub fn (f Foo) foo() string".
+cmd/tools/vvet/tests/module_file_test.vv:46: warning: A function name is missing from the documentation of "pub fn (f Foo) fooo() string".
+cmd/tools/vvet/tests/module_file_test.vv:52: warning: The documentation for "pub fn (f Foo) boo() string" seems incomplete. \ No newline at end of file
diff --git a/v_windows/v/old/cmd/tools/vvet/tests/module_file_test.vv b/v_windows/v/old/cmd/tools/vvet/tests/module_file_test.vv
new file mode 100644
index 0000000..f0f5b24
--- /dev/null
+++ b/v_windows/v/old/cmd/tools/vvet/tests/module_file_test.vv
@@ -0,0 +1,55 @@
+module foo
+
+struct Foo {
+ foo int
+}
+
+pub fn foo() string {
+ // Missing doc
+ return 'foo'
+}
+
+// foo does bar
+pub fn bar() string {
+ // not using convention style: '// <fn name>'
+ return 'bar'
+}
+
+// fooo does x
+pub fn fooo() string {
+ // Documented
+ return 'fooo'
+}
+
+// booo does x
+fn booo() string {
+ // Documented, but not pub
+ return 'booo'
+}
+
+fn boo() string {
+ // Missing doc
+ return 'boo'
+}
+
+pub fn (f Foo) foo() string {
+ // Missing doc
+ return f.fo()
+}
+
+fn (f Foo) fo() string {
+ // Missing doc, but not pub
+ return 'foo'
+}
+
+// wrong doc
+pub fn (f Foo) fooo() string {
+ // not using convention
+ return f.fo()
+}
+
+// boo
+pub fn (f Foo) boo() string {
+ // Incomplete doc
+ return f.fo()
+}
diff --git a/v_windows/v/old/cmd/tools/vvet/tests/parens_space_a.out b/v_windows/v/old/cmd/tools/vvet/tests/parens_space_a.out
new file mode 100644
index 0000000..dbda99a
--- /dev/null
+++ b/v_windows/v/old/cmd/tools/vvet/tests/parens_space_a.out
@@ -0,0 +1,2 @@
+cmd/tools/vvet/tests/parens_space_a.vv:1: error: Looks like you are adding a space after `(`
+NB: You can run `v fmt -w file.v` to fix these errors automatically
diff --git a/v_windows/v/old/cmd/tools/vvet/tests/parens_space_a.vv b/v_windows/v/old/cmd/tools/vvet/tests/parens_space_a.vv
new file mode 100644
index 0000000..2b3b508
--- /dev/null
+++ b/v_windows/v/old/cmd/tools/vvet/tests/parens_space_a.vv
@@ -0,0 +1,4 @@
+fn main() {
+ _ = 1 + ( 1 + 2)
+}
+
diff --git a/v_windows/v/old/cmd/tools/vvet/tests/parens_space_b.out b/v_windows/v/old/cmd/tools/vvet/tests/parens_space_b.out
new file mode 100644
index 0000000..d1d8791
--- /dev/null
+++ b/v_windows/v/old/cmd/tools/vvet/tests/parens_space_b.out
@@ -0,0 +1,2 @@
+cmd/tools/vvet/tests/parens_space_b.vv:1: error: Looks like you are adding a space before `)`
+NB: You can run `v fmt -w file.v` to fix these errors automatically
diff --git a/v_windows/v/old/cmd/tools/vvet/tests/parens_space_b.vv b/v_windows/v/old/cmd/tools/vvet/tests/parens_space_b.vv
new file mode 100644
index 0000000..9ea8932
--- /dev/null
+++ b/v_windows/v/old/cmd/tools/vvet/tests/parens_space_b.vv
@@ -0,0 +1,4 @@
+fn main() {
+ _ = 1 + (1 + 2 )
+}
+
diff --git a/v_windows/v/old/cmd/tools/vvet/tests/trailing_space.out b/v_windows/v/old/cmd/tools/vvet/tests/trailing_space.out
new file mode 100644
index 0000000..1899a21
--- /dev/null
+++ b/v_windows/v/old/cmd/tools/vvet/tests/trailing_space.out
@@ -0,0 +1,7 @@
+cmd/tools/vvet/tests/trailing_space.vv:5: error: Looks like you have trailing whitespace.
+cmd/tools/vvet/tests/trailing_space.vv:6: error: Looks like you have trailing whitespace.
+cmd/tools/vvet/tests/trailing_space.vv:7: error: Looks like you have trailing whitespace.
+cmd/tools/vvet/tests/trailing_space.vv:8: error: Looks like you have trailing whitespace.
+cmd/tools/vvet/tests/trailing_space.vv:9: error: Looks like you have trailing whitespace.
+cmd/tools/vvet/tests/trailing_space.vv:13: error: Looks like you have trailing whitespace.
+cmd/tools/vvet/tests/trailing_space.vv:15: error: Looks like you have trailing whitespace.
diff --git a/v_windows/v/old/cmd/tools/vvet/tests/trailing_space.vv b/v_windows/v/old/cmd/tools/vvet/tests/trailing_space.vv
new file mode 100644
index 0000000..4fe733e
--- /dev/null
+++ b/v_windows/v/old/cmd/tools/vvet/tests/trailing_space.vv
@@ -0,0 +1,16 @@
+// NB: This file has and *should* have trailing spaces.
+// When making changes, please ensure they are not removed.
+
+fn after_comments() {
+ // spaces after line comments give errors
+ /*
+ in block comments
+ too
+ */
+}
+
+fn main() {
+ var := 'error about the spaces right there'
+ no_err := "inside multi line strings it's fine.
+but not after"
+}