]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/cocoa/cocoa-tests.factor
ui.listener: document that ~/.factor-history persists input history
[factor.git] / basis / cocoa / cocoa-tests.factor
index fee8c60c216e441e12531ac5c07702d0efaee376..8b661b908d41681e1f0e05f728da1285e1dc02e9 100644 (file)
@@ -1,53 +1,51 @@
-USING: cocoa cocoa.messages cocoa.subclassing cocoa.types
-compiler.test kernel namespaces cocoa.classes cocoa.runtime
-tools.test memory compiler.units math core-graphics.types ;
-FROM: alien.c-types => int void ;
+USING: alien.c-types cocoa cocoa.classes cocoa.subclassing
+cocoa.types compiler.test core-graphics.types kernel math memory
+namespaces tools.test ;
 IN: cocoa.tests
 
-CLASS: Foo < NSObject
-[
+<CLASS: Foo < NSObject
     METHOD: void foo: NSRect rect [
         gc rect "x" set
-    ]
-]
+    ] ;
+;CLASS>
 
 : test-foo ( -- )
     Foo -> alloc -> init
     dup 1.0 2.0 101.0 102.0 <CGRect> -> foo:
     -> release ;
 
-test-foo
+{ } [ test-foo ] unit-test
 
-[ 1.0 ] [ "x" get CGRect-x ] unit-test
-[ 2.0 ] [ "x" get CGRect-y ] unit-test
-[ 101.0 ] [ "x" get CGRect-w ] unit-test
-[ 102.0 ] [ "x" get CGRect-h ] unit-test
+{ 1.0 } [ "x" get CGRect-x ] unit-test
+{ 2.0 } [ "x" get CGRect-y ] unit-test
+{ 101.0 } [ "x" get CGRect-w ] unit-test
+{ 102.0 } [ "x" get CGRect-h ] unit-test
 
-CLASS: Bar < NSObject
-[
-    METHOD: NSRect bar [ test-foo "x" get ]
-]
+<CLASS: Bar < NSObject
+    METHOD: NSRect bar [ test-foo "x" get ] ;
+;CLASS>
 
-Bar [
-    -> alloc -> init
-    dup -> bar "x" set
-    -> release
-] compile-call
+{ } [
+    Bar [
+        -> alloc -> init
+        dup -> bar "x" set
+        -> release
+    ] compile-call
+] unit-test
 
-[ 1.0 ] [ "x" get CGRect-x ] unit-test
-[ 2.0 ] [ "x" get CGRect-y ] unit-test
-[ 101.0 ] [ "x" get CGRect-w ] unit-test
-[ 102.0 ] [ "x" get CGRect-h ] unit-test
+{ 1.0 } [ "x" get CGRect-x ] unit-test
+{ 2.0 } [ "x" get CGRect-y ] unit-test
+{ 101.0 } [ "x" get CGRect-w ] unit-test
+{ 102.0 } [ "x" get CGRect-h ] unit-test
 
 ! Make sure that we can add methods
-CLASS: Bar < NSObject
-[
-    METHOD: NSRect bar [ test-foo "x" get ]
+<CLASS: Bar < NSObject
+    METHOD: NSRect bar [ test-foo "x" get ] ;
 
-    METHOD: int babb: int x [ x sq ]
-]
+    METHOD: int babb: int x [ x sq ] ;
+;CLASS>
 
-[ 144 ] [
+{ 144 } [
     Bar [
         -> alloc -> init
         dup 12 -> babb: