CustomRBMethodTests.st
changeset 687 2cd68852d81e
parent 686 12e570ea6c6e
child 688 6bd18ba5e56c
--- a/CustomRBMethodTests.st	Tue Oct 07 23:05:10 2014 +0200
+++ b/CustomRBMethodTests.st	Wed Oct 08 19:50:10 2014 +0200
@@ -59,6 +59,18 @@
     "Created: / 06-10-2014 / 08:12:16 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
+test_category_empty_with_none_class
+    | expectedCategory actualCategory |
+
+    expectedCategory := 'as yet unclassified'.
+
+    actualCategory := rbMethod category.
+
+    self assert: expectedCategory = actualCategory
+
+    "Created: / 08-10-2014 / 18:40:37 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
 test_category_from_compiled_method
     | expectedCategory actualCategory |
 
@@ -198,6 +210,66 @@
     "Modified: / 06-10-2014 / 22:33:44 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
+test_compiled_method_empty
+    | expectedMethod actualMethod |
+
+    expectedMethod := nil.
+    actualMethod := rbMethod method.
+
+    self assert: expectedMethod = actualMethod
+
+    "Created: / 08-10-2014 / 19:27:27 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_compiled_method_for_real_method
+    | expectedMethod actualMethod |
+
+    expectedMethod := self class compiledMethodAt: #test_compiled_method_for_real_method.
+
+    rbMethod := RBMethod 
+        for: RBClass new 
+        fromMethod: expectedMethod 
+        andSelector: #test_compiled_method_for_real_method.
+
+    actualMethod := rbMethod method.
+
+    self assert: expectedMethod = actualMethod
+
+    "Created: / 08-10-2014 / 19:30:55 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_compiled_method_for_real_method_empty
+    | expectedMethod actualMethod |
+
+    expectedMethod := self class compiledMethodAt: #test_compiled_method_for_real_method.
+
+    rbMethod 
+        modelClass: (RBClass existingNamed: self className asSymbol); 
+        selector: #test_compiled_method_for_real_method.
+
+    actualMethod := rbMethod method.
+
+    self assert: expectedMethod = actualMethod
+
+    "Created: / 08-10-2014 / 19:32:38 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+test_compiled_method_when_selector_empty
+    | expectedMethod actualMethod |
+
+    expectedMethod := nil.
+
+    rbMethod 
+        modelClass: (RBClass existingNamed: self className asSymbol);
+        source: 'selector_01 ^ 1'.
+
+    actualMethod := rbMethod method.
+
+    self assert: expectedMethod = actualMethod
+
+    "Created: / 08-10-2014 / 19:36:21 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
 test_method_arg_names_none_arg
     | expectedArguments actualArguments |