log_entry_test.go 814 B

123456789101112131415161718192021222324252627
  1. package internal_test
  2. import (
  3. "testing"
  4. . "github.com/v2ray/v2ray-core/common/log/internal"
  5. "github.com/v2ray/v2ray-core/common/serial"
  6. v2testing "github.com/v2ray/v2ray-core/testing"
  7. "github.com/v2ray/v2ray-core/testing/assert"
  8. )
  9. func TestAccessLog(t *testing.T) {
  10. v2testing.Current(t)
  11. entry := &AccessLog{
  12. From: serial.StringLiteral("test_from"),
  13. To: serial.StringLiteral("test_to"),
  14. Status: "Accepted",
  15. Reason: serial.StringLiteral("test_reason"),
  16. }
  17. entryStr := entry.String()
  18. assert.StringLiteral(entryStr).Contains(serial.StringLiteral("test_from"))
  19. assert.StringLiteral(entryStr).Contains(serial.StringLiteral("test_to"))
  20. assert.StringLiteral(entryStr).Contains(serial.StringLiteral("test_reason"))
  21. assert.StringLiteral(entryStr).Contains(serial.StringLiteral("Accepted"))
  22. }