r21737: Print the error strings in the ejs ldb test.
authorAndrew Bartlett <abartlet@samba.org>
Wed, 7 Mar 2007 04:25:52 +0000 (04:25 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:49:21 +0000 (14:49 -0500)
testprogs/ejs/ldap.js

index 9fab283b70a75b34c6ffa0ede1ffb132440c4d03..41442ce1ed19706d55fb17e54c719bf45d7f1899 100755 (executable)
@@ -198,9 +198,11 @@ objectClass: user
 
        println("Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon))");
        var res3 = ldb.search("(&(cn=ldaptestuser)(objectCategory=PerSon))");
-       if (res3.error != 0 || res3.msgs.length != 1) {
-               println("Could not find (&(cn=ldaptestuser)(objectCategory=PerSon))");
+       if (res3.error != 0) {
+               println("Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)): " + res3.errstr);
                assert(res3.error == 0);
+       } else if (res3.msgs.length != 1) {
+               println("Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)): matched " + res3.msgs.length);
                assert(res3.msgs.length == 1);
        }
 
@@ -209,9 +211,11 @@ objectClass: user
        if (gc_ldb != undefined) {
                println("Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog");
                var res3gc = gc_ldb.search("(&(cn=ldaptestuser)(objectCategory=PerSon))");
-               if (res3gc.error != 0 || res3gc.msgs.length != 1) {
-                       println("Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog");
+               if (res3gc.error != 0) {
+                       println("Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog: " + res3gc.errstr);
                        assert(res3gc.error == 0);
+               } else if (res3gc.msgs.length != 1) {
+                       println("Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog: matched " + res3gc.msgs.length);
                        assert(res3gc.msgs.length == 1);
                }