aboutsummaryrefslogtreecommitdiff
path: root/goldap/write_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'goldap/write_test.go')
-rw-r--r--goldap/write_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/goldap/write_test.go b/goldap/write_test.go
new file mode 100644
index 0000000..7c82bd7
--- /dev/null
+++ b/goldap/write_test.go
@@ -0,0 +1,19 @@
+package message
+
+import (
+ "reflect"
+ "testing"
+)
+
+func TestWriteLDAPMessage(t *testing.T) {
+
+ var testData = getLDAPMessageTestData()
+ for i, test := range testData {
+ bytes, err := test.out.Write()
+ if err != nil {
+ t.Errorf("#%d error at offset %d (%s): %s\nEXPECTED BYTES: %#v\nWRITTEN BYTES: %#v\n", i, test.bytes.offset, test.bytes.DumpCurrentBytes(), err, test.bytes.getBytes(), bytes.getBytes())
+ } else if !reflect.DeepEqual(bytes.getBytes(), test.bytes.getBytes()) {
+ t.Errorf("#%d:\nGOT:\n%#+v\nEXPECTED:\n%#+v", i, bytes.getBytes(), test.bytes.getBytes())
+ }
+ }
+}