33 if(err == KErrNone) |
33 if(err == KErrNone) |
34 { |
34 { |
35 TEntry entry; |
35 TEntry entry; |
36 if(fsSession.Entry(aFullName, entry) == KErrNone) |
36 if(fsSession.Entry(aFullName, entry) == KErrNone) |
37 { |
37 { |
38 RDebug::Print(_L("Deleting \"%S\" file.\n"), &aFullName); |
38 TheTest.Printf(_L("Deleting \"%S\" file.\n"), &aFullName); |
39 err = fsSession.SetAtt(aFullName, 0, KEntryAttReadOnly); |
39 err = fsSession.SetAtt(aFullName, 0, KEntryAttReadOnly); |
40 if(err != KErrNone) |
40 if(err != KErrNone) |
41 { |
41 { |
42 RDebug::Print(_L("Error %d changing \"%S\" file attributes.\n"), err, &aFullName); |
42 TheTest.Printf(_L("Error %d changing \"%S\" file attributes.\n"), err, &aFullName); |
43 } |
43 } |
44 err = fsSession.Delete(aFullName); |
44 err = fsSession.Delete(aFullName); |
45 if(err != KErrNone) |
45 if(err != KErrNone) |
46 { |
46 { |
47 RDebug::Print(_L("Error %d deleting \"%S\" file.\n"), err, &aFullName); |
47 TheTest.Printf(_L("Error %d deleting \"%S\" file.\n"), err, &aFullName); |
48 } |
48 } |
49 } |
49 } |
50 fsSession.Close(); |
50 fsSession.Close(); |
51 } |
51 } |
52 else |
52 else |
53 { |
53 { |
54 RDebug::Print(_L("Error %d connecting file session. File: %S.\n"), err, &aFullName); |
54 TheTest.Printf(_L("Error %d connecting file session. File: %S.\n"), err, &aFullName); |
55 } |
55 } |
56 } |
56 } |
57 |
57 |
58 /////////////////////////////////////////////////////////////////////////////////////// |
58 /////////////////////////////////////////////////////////////////////////////////////// |
59 /////////////////////////////////////////////////////////////////////////////////////// |
59 /////////////////////////////////////////////////////////////////////////////////////// |
62 static void Check(TInt aValue, TInt aLine) |
62 static void Check(TInt aValue, TInt aLine) |
63 { |
63 { |
64 if(!aValue) |
64 if(!aValue) |
65 { |
65 { |
66 ::DeleteDataFile(KSearchTestDbPath); |
66 ::DeleteDataFile(KSearchTestDbPath); |
|
67 TheTest.Printf(_L("*** Expression evaluated to false\r\n")); |
67 TheTest(EFalse, aLine); |
68 TheTest(EFalse, aLine); |
68 } |
69 } |
69 } |
70 } |
70 //If (aValue != aExpected) then the test will be panicked, the test data files will be deleted. |
71 //If (aValue != aExpected) then the test will be panicked, the test data files will be deleted. |
71 static void Check(TInt aValue, TInt aExpected, TInt aLine) |
72 static void Check(TInt aValue, TInt aExpected, TInt aLine) |
72 { |
73 { |
73 if(aValue != aExpected) |
74 if(aValue != aExpected) |
74 { |
75 { |
75 RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); |
76 TheTest.Printf(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); |
76 ::DeleteDataFile(KSearchTestDbPath); |
77 ::DeleteDataFile(KSearchTestDbPath); |
77 TheTest(EFalse, aLine); |
78 TheTest(EFalse, aLine); |
78 } |
79 } |
79 } |
80 } |
80 //Use these to test conditions. |
81 //Use these to test conditions. |
83 |
84 |
84 /////////////////////////////////////////////////////////////////////////////////////// |
85 /////////////////////////////////////////////////////////////////////////////////////// |
85 |
86 |
86 static void LeaveL(TInt aLine, TInt aError) |
87 static void LeaveL(TInt aLine, TInt aError) |
87 { |
88 { |
88 RDebug::Print(_L("*** Leave. Error: %d, line: %d\r\n"), aError, aLine); |
89 TheTest.Printf(_L("*** Leave. Error: %d, line: %d\r\n"), aError, aLine); |
89 User::Leave(aError); |
90 User::Leave(aError); |
90 } |
91 } |
91 static void LeaveIfErrorL(TInt aLine, TInt aError) |
92 static void LeaveIfErrorL(TInt aLine, TInt aError) |
92 { |
93 { |
93 if(aError < KErrNone) |
94 if(aError < KErrNone) |