# HG changeset patch
# User Nicky <nickyd_sl@yahoo.com>
# Date 1288698643 -3600
# Branch storm-102
# Node ID c2ffd0fde18d45263e62a596c8c1a18ff4b732b2
# Parent  2b29fdb3bcfbfe1c868a9704c2eec9119e8bb4e4
- Enable test 8.
- Fix out of bounds array access in scanTest. This made the test crash if it failed.
- Make the string parameters to scanTest const& so they are not copied over the stack. The bool array const so it cannot be modified.

diff --git a/indra/llvfs/tests/lldir_test.cpp b/indra/llvfs/tests/lldir_test.cpp
--- a/indra/llvfs/tests/lldir_test.cpp
+++ b/indra/llvfs/tests/lldir_test.cpp
@@ -289,9 +289,8 @@
 
    static const char* DirScanFilename[5] = { "file1.abc", "file2.abc", "file1.xyz", "file2.xyz", "file1.mno" };
    
-   void scanTest(const std::string directory, const std::string pattern, bool correctResult[5])
+   void scanTest(const std::string &directory, const std::string &pattern, bool const correctResult[5])
    {
-
       // Scan directory and see if any file1.* files are found
       std::string scanResult;
       int   found = 0;
@@ -300,6 +299,10 @@
 
       while ( found <= 5 && gDirUtilp->getNextFileInDir(directory, pattern, scanResult) )
       {
+	    // Nicky D.: Do not match the special directories '.' (current dir) or '..' (parent)
+		if( scanResult == "." || scanResult == ".." )
+			continue;
+
          found++;
          std::cerr << "  found '"+scanResult+"'\n";
          int check;
@@ -314,7 +317,8 @@
          }
          else // check is 5 - should not happen
          {
-            ensure( "found unknown file '"+(std::string)DirScanFilename[check]+"'", false);
+		    // Nicky D: Report the file that was found but not expected.
+            ensure( "found unknown file '"+scanResult+"'", false);
          }
       }
       for (int i=0; i<5; i++)
@@ -378,10 +382,10 @@
       scanTest(dir2, "file?.x?z", expected7);
 
       // Scan dir2 and see if any file?.??c files are found - THESE FAIL AND SO ARE COMMENTED OUT FOR NOW
-      //      bool  expected8[5] = { true, true, false, false, false };
-      //      scanTest(dir2, "file?.??c", expected8);
-      //      bool  expected8[5] = { true, true, false, false, false };
-      //      scanTest(dir2, "*.??c", expected8);
+      bool  expected8[5] = { true, true, false, false, false };
+      scanTest(dir2, "file?.??c", expected8);
+//      bool  expected8_2[5] = { true, true, false, false, false };
+      scanTest(dir2, "*.??c", expected8);
 
       // Scan dir1 and see if any *.?n? files are found
       bool  expected9[5] = { false, false, false, false, true };
