summaryrefslogtreecommitdiff
path: root/addons/gdUnit4/src/core/report
diff options
context:
space:
mode:
authorradiohotline <radoihotline@disroot.rg>2026-08-25 16:33:56 +0300
committerradiohotline <radoihotline@disroot.rg>2026-08-25 16:33:56 +0300
commita89e744ed0e8c759caf041a580112365bbfe4303 (patch)
treedd61e320904176995727e86a857d00c90d4933ba /addons/gdUnit4/src/core/report
parent6d53d8cac78250dc888aa49d5f9d4175c6652feb (diff)
escoria updateHEADmain
Diffstat (limited to 'addons/gdUnit4/src/core/report')
-rw-r--r--addons/gdUnit4/src/core/report/GdUnitReport.gd84
-rw-r--r--addons/gdUnit4/src/core/report/GdUnitReport.gd.uid1
2 files changed, 85 insertions, 0 deletions
diff --git a/addons/gdUnit4/src/core/report/GdUnitReport.gd b/addons/gdUnit4/src/core/report/GdUnitReport.gd
new file mode 100644
index 0000000..aaf309f
--- /dev/null
+++ b/addons/gdUnit4/src/core/report/GdUnitReport.gd
@@ -0,0 +1,84 @@
+class_name GdUnitReport
+extends Resource
+
+# report type
+enum {
+ SUCCESS,
+ WARN,
+ FAILURE,
+ ORPHAN,
+ TERMINATED,
+ INTERUPTED,
+ ABORT,
+ SKIPPED,
+}
+
+var _type :int
+var _line_number :int
+var _message :String
+var _current_value: Variant
+
+
+func create(p_type :int, p_line_number :int, p_message :String) -> GdUnitReport:
+ _type = p_type
+ _line_number = p_line_number
+ _message = p_message
+ return self
+
+
+func with_current_value(value: Variant) -> GdUnitReport:
+ _current_value = value
+ return self
+
+
+func type() -> int:
+ return _type
+
+
+func line_number() -> int:
+ return _line_number
+
+
+func message() -> String:
+ return _message
+
+
+func is_skipped() -> bool:
+ return _type == SKIPPED
+
+
+func is_warning() -> bool:
+ return _type == WARN
+
+
+func is_failure() -> bool:
+ return _type == FAILURE
+
+
+func is_error() -> bool:
+ return _type == TERMINATED or _type == INTERUPTED or _type == ABORT
+
+
+func is_orphan() -> bool:
+ return _type == ORPHAN
+
+
+func _to_string() -> String:
+ if _line_number == -1:
+ return "[color=green]line [/color][color=aqua]<n/a>:[/color] %s" % [_message]
+ return "[color=green]line [/color][color=aqua]%d:[/color] %s" % [_line_number, _message]
+
+
+func serialize() -> Dictionary:
+ return {
+ "type" :_type,
+ "line_number" :_line_number,
+ "message" :_message
+ }
+
+
+func deserialize(serialized :Dictionary) -> GdUnitReport:
+ _type = serialized["type"]
+ _line_number = serialized["line_number"]
+ _message = serialized["message"]
+ return self
diff --git a/addons/gdUnit4/src/core/report/GdUnitReport.gd.uid b/addons/gdUnit4/src/core/report/GdUnitReport.gd.uid
new file mode 100644
index 0000000..934a280
--- /dev/null
+++ b/addons/gdUnit4/src/core/report/GdUnitReport.gd.uid
@@ -0,0 +1 @@
+uid://c27ddgo83osir