The reconcile package is used for DOM reconcilation in Isomorphic Go web applications.

vm_extension_test.go 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2016 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package bpf_test
  5. import (
  6. "testing"
  7. "golang.org/x/net/bpf"
  8. )
  9. func TestVMLoadExtensionNotImplemented(t *testing.T) {
  10. _, _, err := testVM(t, []bpf.Instruction{
  11. bpf.LoadExtension{
  12. Num: 100,
  13. },
  14. bpf.RetA{},
  15. })
  16. if errStr(err) != "extension 100 not implemented" {
  17. t.Fatalf("unexpected error: %v", err)
  18. }
  19. }
  20. func TestVMLoadExtensionExtLen(t *testing.T) {
  21. vm, done, err := testVM(t, []bpf.Instruction{
  22. bpf.LoadExtension{
  23. Num: bpf.ExtLen,
  24. },
  25. bpf.RetA{},
  26. })
  27. if err != nil {
  28. t.Fatalf("failed to load BPF program: %v", err)
  29. }
  30. defer done()
  31. out, err := vm.Run([]byte{
  32. 0xff, 0xff, 0xff, 0xff,
  33. 0xff, 0xff, 0xff, 0xff,
  34. 0, 1, 2, 3,
  35. })
  36. if err != nil {
  37. t.Fatalf("unexpected error while running program: %v", err)
  38. }
  39. if want, got := 4, out; want != got {
  40. t.Fatalf("unexpected number of output bytes:\n- want: %d\n- got: %d",
  41. want, got)
  42. }
  43. }