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

tests: interface: rename Speaker to Animal

This commit is contained in:
Alexander Medvednikov 2020-05-04 10:58:37 +02:00
parent acd80f052b
commit eca24c5d11

View File

@ -33,7 +33,7 @@ fn test_todo() {
}
fn perform_speak(s Speaker) {
fn perform_speak(s Animal) {
s.speak('Hi !')
assert true
name := s.name()
@ -50,7 +50,7 @@ fn test_perform_speak() {
cat := Cat{}
perform_speak(cat)
perform_speak(Cat{})
perform_speakers([dog, cat])
handle_animals([dog, cat])
/*
f := Foo {
speaker: dog
@ -58,7 +58,7 @@ fn test_perform_speak() {
*/
}
fn perform_speakers(speakers []Speaker) {}
fn handle_animals(a []Animal) {}
interface Register {
register()
@ -85,18 +85,18 @@ interface Speaker2 {
struct Foo {
speaker Speaker
speakers []Speaker
animal Animal
animals []Animal
}
interface Speaker {
interface Animal {
name() string
speak(s string)
}
fn test_interface_array() {
mut animals := []Speaker{}
mut animals := []Animal{}
animals = [ Cat{}, Dog{} ]
animals << Cat{}
assert true