hostinfo_linux_test.go 723 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright (c) Tailscale Inc & AUTHORS
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. //go:build linux && !android
  4. package hostinfo
  5. import (
  6. "testing"
  7. )
  8. func TestQnap(t *testing.T) {
  9. version_info := `commit 2910d3a594b068024ed01a64a0fe4168cb001a12
  10. Date: 2022-05-30 16:08:45 +0800
  11. ================================================
  12. * QTSFW_5.0.0
  13. remotes/origin/QTSFW_5.0.0`
  14. got := getQnapQtsVersion(version_info)
  15. want := "5.0.0"
  16. if got != want {
  17. t.Errorf("got %q; want %q", got, want)
  18. }
  19. got = getQnapQtsVersion("")
  20. want = ""
  21. if got != want {
  22. t.Errorf("got %q; want %q", got, want)
  23. }
  24. got = getQnapQtsVersion("just a bunch of junk")
  25. want = ""
  26. if got != want {
  27. t.Errorf("got %q; want %q", got, want)
  28. }
  29. }