logging: adds clock scope (#1071)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2023-01-28 19:11:37 +02:00
committed by GitHub
parent bd9a791c7a
commit d944c3c70d
14 changed files with 312 additions and 94 deletions

View File

@@ -25,21 +25,10 @@ func Test_crypto(t *testing.T) {
require.Equal(t, `7a0c9f9f0d
`, stdout)
// TODO: Go 1.17 initializes randoms in a different order than Go 1.18,19
// When we move to 1.20, remove the workaround.
if log.String() != `==> go.runtime.getRandomData(r_len=32)
<==
==> go.runtime.getRandomData(r_len=8)
<==
==> go.syscall/js.valueCall(crypto.getRandomValues(r_len=5))
<== (n=5)
` {
require.Equal(t, `==> go.runtime.getRandomData(r_len=8)
<==
==> go.runtime.getRandomData(r_len=32)
<==
==> go.syscall/js.valueCall(crypto.getRandomValues(r_len=5))
<== (n=5)
`, log.String())
}
// Search for the two functions that should be in scope, flexibly, to pass
// go 1.17-19
require.Contains(t, log.String(), `go.runtime.getRandomData(r_len=32)
<==`)
require.Contains(t, log.String(), `==> go.syscall/js.valueCall(crypto.getRandomValues(r_len=5))
<== (n=5)`)
}