refraction-networking / water

WebAssembly Transport Executables Runtime
Apache License 2.0
22 stars 1 forks source link

test: improve and simplify examples in water_test #29

Closed gaukas closed 7 months ago

gaukas commented 7 months ago

The code for ExampleXxx is highly redundant and unclear, it is better if we could further simplify it.

Plus, consider breaking ExampleDialer by moving definitions for internal variables out of dialer_test.go. Currently go.dev generated a runable example for ExampleDialer but in fact it won't run since go.dev does not have a copy of testdata:

Output:

go: downloading github.com/gaukas/water v0.4.0
go: downloading github.com/tetratelabs/wazero v1.6.0
go: downloading google.golang.org/protobuf v1.32.0
prog.go:15:13: pattern transport/v0/testdata/plain.wasm: no matching files found