status_test.go 576 B

123456789101112131415161718192021
  1. // Copyright 2011 Andy Balholm. 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 icap
  5. import (
  6. "testing"
  7. )
  8. func checkString(description, is, shouldBe string, t *testing.T) {
  9. if is != shouldBe {
  10. t.Fatalf("%s is %s (should be %s)", description, is, shouldBe)
  11. }
  12. }
  13. func TestStatusCodes(t *testing.T) {
  14. checkString("Message", StatusText(100), "Continue", t)
  15. checkString("Message", StatusText(401), "Unauthorized", t)
  16. checkString("Status-not-found message", StatusText(12345), "", t)
  17. }