Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F7613586
D1226.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
943 B
Referenced Files
None
Subscribers
None
D1226.diff
View Options
diff --git a/Core.tcl b/Core.tcl
--- a/Core.tcl
+++ b/Core.tcl
@@ -124,6 +124,10 @@
# Strings
#
+proc strlen {str} {
+ string length $str
+}
+
#Completes $text by spaces or $char so the returned text length is $len
proc completestring {text len {char " "}} {
set curlen [string length $text]
diff --git a/tests/Core.test b/tests/Core.test
new file mode 100644
--- /dev/null
+++ b/tests/Core.test
@@ -0,0 +1,26 @@
+package require tcltest
+namespace import ::tcltest::*
+
+###
+### Init
+###
+
+source init.tcl
+
+###
+### Tests
+###
+
+test strlen_regular_string {} -body {
+ strlen "quux"
+} -result 4
+
+test strlen_empty_string {} -body {
+ strlen ""
+} -result 0
+
+###
+### Cleanup
+###
+
+cleanupTests
diff --git a/tests/init.tcl b/tests/init.tcl
--- a/tests/init.tcl
+++ b/tests/init.tcl
@@ -13,8 +13,3 @@
# Standard procedures
source $dir/Core.tcl
-
-# Eggdrop procedures
-proc strlen {text} {
- string length $text
-}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 30, 17:52 (18 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2619364
Default Alt Text
D1226.diff (943 B)
Attached To
Mode
D1226: Provide strlen compatibility method
Attached
Detach File
Event Timeline
Log In to Comment