1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tools: add tests for v where; improve usability (#15059)

This commit is contained in:
Sebastian Atlántico
2022-07-15 01:59:11 -03:00
committed by GitHub
parent 89a757aba0
commit 4f997feee7
8 changed files with 356 additions and 56 deletions

View File

@@ -0,0 +1,28 @@
module test
// Test declarations
fn main() {
p_1 := Programmer{'Programmer', 'Inmutable'}
mut p_2 := Programmer{'Programmer', 'Mutable'}
}
struct Programmer {
f_name string
l_name string
}
fn (p Programmer) drink(cups int) string {
return 'drink coffee, return program'
}
pub struct Brogrammer {
f_name string
life []Stories
}
pub fn (p Brogrammer) drink(glasses int) string {
return 'drink beer, return script cluster'
}
struct Stories {}

View File

@@ -0,0 +1,29 @@
module test
const (
x = 10
y = 100
z = 1000
)
pub enum Public {
importable
shareable
}
enum Private {
storable
donwloadable
}
interface Drinker {
drink(int) string
}
pub fn sprint(dkr Drinker) {
println(drk.drink(6))
}
fn some_function_name(foo string, bar int) string {
return 'baz'
}

View File

@@ -0,0 +1,7 @@
module nested_mod
pub const (
a = 30
b = 60
c = 120
)