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

v test-fmt: reformat some skipped files, comment on the remaining ones

This commit is contained in:
Delyan Angelov
2020-10-15 00:39:09 +03:00
parent e36f11750b
commit 3795aaab5c
19 changed files with 262 additions and 347 deletions

View File

@ -1,35 +1,28 @@
import eventbus
struct EventData {
data string
data string
}
fn test_eventbus(){
fn test_eventbus() {
ev_data := &EventData{'hello'}
mut eb := eventbus.new()
eb.subscriber.subscribe_once("on_test", on_test)
assert eb.has_subscriber("on_test")
assert eb.subscriber.is_subscribed("on_test")
eb.publish("on_test", eb, ev_data)
assert !eb.has_subscriber("on_test")
assert !eb.subscriber.is_subscribed("on_test")
eb.subscriber.subscribe("on_test", on_test)
assert eb.has_subscriber("on_test")
assert eb.subscriber.is_subscribed("on_test")
eb.subscriber.subscribe_once('on_test', on_test)
assert eb.has_subscriber('on_test')
assert eb.subscriber.is_subscribed('on_test')
eb.publish('on_test', eb, ev_data)
assert !eb.has_subscriber('on_test')
assert !eb.subscriber.is_subscribed('on_test')
eb.subscriber.subscribe('on_test', on_test)
assert eb.has_subscriber('on_test')
assert eb.subscriber.is_subscribed('on_test')
eb.clear_all()
assert !eb.has_subscriber("on_test")
assert !eb.subscriber.is_subscribed("on_test")
assert !eb.has_subscriber('on_test')
assert !eb.subscriber.is_subscribed('on_test')
}
fn on_test(receiver voidptr, ev &EventData, sender voidptr) {
assert receiver == 0
assert sender != 0
assert ev.data == "hello"
assert ev.data == 'hello'
}