]>
Commit | Line | Data |
---|---|---|
c4ba7c44 DK |
1 | #include <apt-pkg/error.h> |
2 | ||
3 | #include "assert.h" | |
4 | #include <string> | |
5 | ||
6 | int main(int argc,char *argv[]) | |
7 | { | |
8 | equals(_error->empty(), true); | |
9 | equals(_error->PendingError(), false); | |
10 | equals(_error->Notice("%s Notice", "A"), false); | |
11 | equals(_error->empty(), true); | |
12 | equals(_error->empty(GlobalError::DEBUG), false); | |
13 | equals(_error->PendingError(), false); | |
14 | equals(_error->Error("%s horrible %s %d times", "Something", "happend", 2), false); | |
15 | equals(_error->PendingError(), true); | |
16 | std::string text; | |
17 | equals(_error->PopMessage(text), false); | |
18 | equals(_error->PendingError(), true); | |
19 | equals(text, "A Notice"); | |
20 | equals(_error->PopMessage(text), true); | |
21 | equals(text, "Something horrible happend 2 times"); | |
22 | equals(_error->empty(GlobalError::DEBUG), true); | |
23 | equals(_error->PendingError(), false); | |
24 | equals(_error->Error("%s horrible %s %d times", "Something", "happend", 2), false); | |
25 | equals(_error->PendingError(), true); | |
26 | equals(_error->empty(GlobalError::FATAL), false); | |
27 | _error->Discard(); | |
28 | ||
29 | equals(_error->empty(), true); | |
30 | equals(_error->PendingError(), false); | |
31 | equals(_error->Notice("%s Notice", "A"), false); | |
32 | equals(_error->Error("%s horrible %s %d times", "Something", "happend", 2), false); | |
33 | equals(_error->PendingError(), true); | |
34 | equals(_error->empty(GlobalError::NOTICE), false); | |
35 | _error->PushToStack(); | |
36 | equals(_error->empty(GlobalError::NOTICE), true); | |
37 | equals(_error->PendingError(), false); | |
38 | equals(_error->Warning("%s Warning", "A"), false); | |
39 | equals(_error->empty(GlobalError::ERROR), true); | |
40 | equals(_error->PendingError(), false); | |
41 | _error->RevertToStack(); | |
42 | equals(_error->empty(GlobalError::ERROR), false); | |
43 | equals(_error->PendingError(), true); | |
44 | equals(_error->PopMessage(text), false); | |
45 | equals(_error->PendingError(), true); | |
46 | equals(text, "A Notice"); | |
47 | equals(_error->PopMessage(text), true); | |
48 | equals(text, "Something horrible happend 2 times"); | |
49 | equals(_error->PendingError(), false); | |
50 | equals(_error->empty(), true); | |
51 | ||
52 | equals(_error->Notice("%s Notice", "A"), false); | |
53 | equals(_error->Error("%s horrible %s %d times", "Something", "happend", 2), false); | |
54 | equals(_error->PendingError(), true); | |
55 | equals(_error->empty(GlobalError::NOTICE), false); | |
56 | _error->PushToStack(); | |
57 | equals(_error->empty(GlobalError::NOTICE), true); | |
58 | equals(_error->PendingError(), false); | |
59 | equals(_error->Warning("%s Warning", "A"), false); | |
60 | equals(_error->empty(GlobalError::ERROR), true); | |
61 | equals(_error->PendingError(), false); | |
62 | _error->MergeWithStack(); | |
63 | equals(_error->empty(GlobalError::ERROR), false); | |
64 | equals(_error->PendingError(), true); | |
65 | equals(_error->PopMessage(text), false); | |
66 | equals(_error->PendingError(), true); | |
67 | equals(text, "A Notice"); | |
68 | equals(_error->PopMessage(text), true); | |
69 | equals(text, "Something horrible happend 2 times"); | |
70 | equals(_error->PendingError(), false); | |
71 | equals(_error->empty(), false); | |
72 | equals(_error->PopMessage(text), false); | |
73 | equals(text, "A Warning"); | |
74 | equals(_error->empty(), true); | |
75 | ||
76 | return 0; | |
77 | } |