Paul Vriens : setupapi/tests: Add some tests for the last error returned.

Alexandre Julliard julliard at winehq.org
Thu Mar 27 15:43:24 CDT 2008


Module: wine
Branch: master
Commit: 18e305241dcce3f12c25da50f7126a8ffd9cc07a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=18e305241dcce3f12c25da50f7126a8ffd9cc07a

Author: Paul Vriens <paul.vriens.wine at gmail.com>
Date:   Thu Mar 27 12:17:35 2008 +0100

setupapi/tests: Add some tests for the last error returned.

---

 dlls/setupapi/tests/parser.c |  119 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 119 insertions(+), 0 deletions(-)

diff --git a/dlls/setupapi/tests/parser.c b/dlls/setupapi/tests/parser.c
index 1c3ca49..8b9a520 100644
--- a/dlls/setupapi/tests/parser.c
+++ b/dlls/setupapi/tests/parser.c
@@ -480,6 +480,124 @@ static void test_pSetupGetField(void)
     SetupCloseInfFile( hinf );
 }
 
+static void test_GLE(void)
+{
+    static const char *inf =
+        "[Version]\n"
+        "Signature=\"$Windows NT$\"\n"
+        "[Sectionname]\n"
+        "Keyname1=Field1,Field2,Field3\n"
+        "\n"
+        "Keyname2=Field4,Field5\n";
+    HINF hinf;
+    UINT err;
+    INFCONTEXT context;
+    BOOL retb;
+    LONG retl;
+    char buf[MAX_INF_STRING_LENGTH];
+    int bufsize = MAX_INF_STRING_LENGTH;
+    DWORD retsize;
+
+    hinf = test_file_contents( inf, &err );
+    ok( hinf != NULL, "Expected valid INF file\n" );
+
+    SetLastError(0xdeadbeef);
+    retb = SetupFindFirstLineA( hinf, "ImNotThere", NULL, &context );
+    ok(!retb, "Expected failure\n");
+    todo_wine
+    ok(GetLastError() == ERROR_LINE_NOT_FOUND,
+        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    retb = SetupFindFirstLineA( hinf, "ImNotThere", "ImNotThere", &context );
+    ok(!retb, "Expected failure\n");
+    todo_wine
+    ok(GetLastError() == ERROR_LINE_NOT_FOUND,
+        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    retb = SetupFindFirstLineA( hinf, "Sectionname", NULL, &context );
+    ok(retb, "Expected success\n");
+    ok(GetLastError() == ERROR_SUCCESS,
+        "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    retb = SetupFindFirstLineA( hinf, "Sectionname", "ImNotThere", &context );
+    ok(!retb, "Expected failure\n");
+    ok(GetLastError() == ERROR_LINE_NOT_FOUND,
+        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    retb = SetupFindFirstLineA( hinf, "Sectionname", "Keyname1", &context );
+    ok(retb, "Expected success\n");
+    ok(GetLastError() == ERROR_SUCCESS,
+        "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    retb = SetupFindNextMatchLineA( &context, "ImNotThere", &context );
+    ok(!retb, "Expected failure\n");
+    ok(GetLastError() == ERROR_LINE_NOT_FOUND,
+        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    retb = SetupFindNextMatchLineA( &context, "Keyname2", &context );
+    ok(retb, "Expected success\n");
+    ok(GetLastError() == ERROR_SUCCESS,
+        "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    retl = SetupGetLineCountA( hinf, "ImNotThere");
+    ok(retl == -1, "Expected -1, got %d\n", retl);
+    ok(GetLastError() == ERROR_SECTION_NOT_FOUND,
+        "Expected ERROR_SECTION_NOT_FOUND, got %08x\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    retl = SetupGetLineCountA( hinf, "Sectionname");
+    ok(retl == 2, "Expected 2, got %d\n", retl);
+    ok(GetLastError() == ERROR_SUCCESS,
+        "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    retb = SetupGetLineTextA( NULL, hinf, "ImNotThere", "ImNotThere", buf, bufsize, &retsize);
+    ok(!retb, "Expected failure\n");
+    todo_wine
+    ok(GetLastError() == ERROR_LINE_NOT_FOUND,
+        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    retb = SetupGetLineTextA( NULL, hinf, "Sectionname", "ImNotThere", buf, bufsize, &retsize);
+    ok(!retb, "Expected failure\n");
+    ok(GetLastError() == ERROR_LINE_NOT_FOUND,
+        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    retb = SetupGetLineTextA( NULL, hinf, "Sectionname", "Keyname1", buf, bufsize, &retsize);
+    ok(retb, "Expected success\n");
+    ok(GetLastError() == ERROR_SUCCESS,
+        "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    retb = SetupGetLineByIndexA( hinf, "ImNotThere", 1, &context );
+    ok(!retb, "Expected failure\n");
+    todo_wine
+    ok(GetLastError() == ERROR_LINE_NOT_FOUND,
+        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    retb = SetupGetLineByIndexA( hinf, "Sectionname", 1, &context );
+    ok(retb, "Expected success\n");
+    ok(GetLastError() == ERROR_SUCCESS,
+        "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+
+    SetLastError(0xdeadbeef);
+    retb = SetupGetLineByIndexA( hinf, "Sectionname", 3, &context );
+    ok(!retb, "Expected failure\n");
+    ok(GetLastError() == ERROR_LINE_NOT_FOUND,
+        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+
+    SetupCloseInfFile( hinf );
+}
+
 START_TEST(parser)
 {
     init_function_pointers();
@@ -488,5 +606,6 @@ START_TEST(parser)
     test_key_names();
     test_close_inf_file();
     test_pSetupGetField();
+    test_GLE();
     DeleteFileA( tmpfilename );
 }




More information about the wine-cvs mailing list