commit 34f9fddca3d5c6a5a2e8b7292b61f52bcaf54db5
Author: David Fifield <[email protected]>
Date:   Sun Nov 3 12:40:08 2013 -0800

    Add test for getManagedTransportVer.
---
 src/pt/pt_test.go |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/pt/pt_test.go b/src/pt/pt_test.go
index 3cf5ed5..cc7924a 100644
--- a/src/pt/pt_test.go
+++ b/src/pt/pt_test.go
@@ -1,5 +1,6 @@
 package pt
 
+import "os"
 import "testing"
 
 func stringIsSafe(s string) bool {
@@ -38,3 +39,23 @@ func TestEscape(t *testing.T) {
                check(string(b))
        }
 }
+
+func TestGetManagedTransportVer(t *testing.T) {
+       tests := [...]struct {
+               input, expected string
+       }{
+               {"1", "1"},
+               {"1,1", "1"},
+               {"1,2", "1"},
+               {"2,1", "1"},
+               {"2", ""},
+       }
+
+       for _, test := range tests {
+               os.Setenv("TOR_PT_MANAGED_TRANSPORT_VER", test.input)
+               output := getManagedTransportVer()
+               if output != test.expected {
+                       t.Errorf("%q → %q (expected %q)", test.input, output, 
test.expected)
+               }
+       }
+}



_______________________________________________
tor-commits mailing list
[email protected]
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to