Skip to content

Commit c2f1507

Browse files
test: add global logging functions test cases
- Test calling global logging functions without errors - Test handling empty messages in global functions - Test handling special characters in global functions - Test handling rapid calls to global functions
1 parent e6404aa commit c2f1507

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

test/logger_test.dart

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,47 @@ void main() {
244244
}, returnsNormally);
245245
});
246246
});
247+
group("Global Logging Functions", () {
248+
test("should call global logging functions without error", () {
249+
expect(() {
250+
logError("Global error message");
251+
logWarning("Global warning message");
252+
logInfo("Global info message");
253+
logDebug("Global debug message");
254+
}, returnsNormally);
255+
});
256+
257+
test("should handle empty messages in global functions", () {
258+
expect(() {
259+
logError("");
260+
logWarning("");
261+
logInfo("");
262+
logDebug("");
263+
}, returnsNormally);
264+
});
265+
266+
test("should handle special characters in global functions", () {
267+
var specialMessage = "Special: 🚀 \n\t 世界";
268+
269+
expect(() {
270+
logError(specialMessage);
271+
logWarning(specialMessage);
272+
logInfo(specialMessage);
273+
logDebug(specialMessage);
274+
}, returnsNormally);
275+
});
247276

277+
test("should handle rapid calls to global functions", () {
278+
expect(() {
279+
for (int i = 0; i < 25; i++) {
280+
logError("Rapid error $i");
281+
logWarning("Rapid warning $i");
282+
logInfo("Rapid info $i");
283+
logDebug("Rapid debug $i");
284+
}
285+
}, returnsNormally);
286+
});
287+
});
248288
group("Concurrent Access", () {
249289
test("should handle multiple concurrent log calls", () async {
250290
var testLogger = TestLogger();

0 commit comments

Comments
 (0)