From 62976058ee9a5c7876d7357320f88e358c785f24 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 14 Jan 2009 01:00:54 -0600 Subject: [PATCH 1/2] Add testcase for mnestic's deploy bug --- basis/tools/deploy/deploy-tests.factor | 23 +++++++--------------- basis/tools/deploy/test/10/10-tests.factor | 4 ++++ basis/tools/deploy/test/10/10.factor | 8 ++++++++ basis/tools/deploy/test/10/authors.txt | 1 + basis/tools/deploy/test/10/deploy.factor | 15 ++++++++++++++ basis/tools/deploy/test/test.factor | 19 ++++++++++++++++++ 6 files changed, 54 insertions(+), 16 deletions(-) create mode 100644 basis/tools/deploy/test/10/10-tests.factor create mode 100644 basis/tools/deploy/test/10/10.factor create mode 100644 basis/tools/deploy/test/10/authors.txt create mode 100644 basis/tools/deploy/test/10/deploy.factor create mode 100644 basis/tools/deploy/test/test.factor diff --git a/basis/tools/deploy/deploy-tests.factor b/basis/tools/deploy/deploy-tests.factor index e15ba9b90e..8b36947f43 100644 --- a/basis/tools/deploy/deploy-tests.factor +++ b/basis/tools/deploy/deploy-tests.factor @@ -3,17 +3,8 @@ USING: tools.test system io.pathnames io.files io.files.info io.files.temp kernel tools.deploy.config tools.deploy.config.editor tools.deploy.backend math sequences io.launcher arrays namespaces continuations layouts accessors -io.encodings.ascii urls math.parser io.directories ; - -: shake-and-bake ( vocab -- ) - [ "test.image" temp-file delete-file ] ignore-errors - "resource:" [ - [ vm "test.image" temp-file ] dip - dup deploy-config make-deploy-image - ] with-directory ; - -: small-enough? ( n -- ? ) - [ "test.image" temp-file file-info size>> ] [ cell 4 / * ] bi* <= ; +io.encodings.ascii urls math.parser io.directories +tools.deploy.test ; [ t ] [ "hello-world" shake-and-bake 500000 small-enough? ] unit-test @@ -36,11 +27,6 @@ os macosx? [ [ t ] [ "webkit-demo" shake-and-bake 500000 small-enough? ] unit-test ] when -: run-temp-image ( -- ) - vm - "-i=" "test.image" temp-file append - 2array try-process ; - { "tools.deploy.test.1" "tools.deploy.test.2" @@ -113,3 +99,8 @@ M: quit-responder call-responder* "tools.deploy.test.9" shake-and-bake run-temp-image ] unit-test + +[ ] [ + "tools.deploy.test.10" shake-and-bake + run-temp-image +] unit-test diff --git a/basis/tools/deploy/test/10/10-tests.factor b/basis/tools/deploy/test/10/10-tests.factor new file mode 100644 index 0000000000..ba6f354aa5 --- /dev/null +++ b/basis/tools/deploy/test/10/10-tests.factor @@ -0,0 +1,4 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: tools.test tools.deploy.test.10 ; +IN: tools.deploy.test.10.tests diff --git a/basis/tools/deploy/test/10/10.factor b/basis/tools/deploy/test/10/10.factor new file mode 100644 index 0000000000..95329ff7f2 --- /dev/null +++ b/basis/tools/deploy/test/10/10.factor @@ -0,0 +1,8 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: prettyprint ; +IN: tools.deploy.test.10 + +: main ( -- ) C{ 0 1 } pprint ; + +MAIN: main \ No newline at end of file diff --git a/basis/tools/deploy/test/10/authors.txt b/basis/tools/deploy/test/10/authors.txt new file mode 100644 index 0000000000..d4f5d6b3ae --- /dev/null +++ b/basis/tools/deploy/test/10/authors.txt @@ -0,0 +1 @@ +Slava Pestov \ No newline at end of file diff --git a/basis/tools/deploy/test/10/deploy.factor b/basis/tools/deploy/test/10/deploy.factor new file mode 100644 index 0000000000..3f5940651d --- /dev/null +++ b/basis/tools/deploy/test/10/deploy.factor @@ -0,0 +1,15 @@ +USING: tools.deploy.config ; +H{ + { deploy-reflection 3 } + { deploy-unicode? f } + { deploy-io 2 } + { deploy-word-props? f } + { deploy-compiler? f } + { deploy-threads? f } + { deploy-word-defs? f } + { "stop-after-last-window?" t } + { deploy-ui? f } + { deploy-math? t } + { deploy-c-types? f } + { deploy-name "tools.deploy.test.10" } +} diff --git a/basis/tools/deploy/test/test.factor b/basis/tools/deploy/test/test.factor new file mode 100644 index 0000000000..eb780e40cc --- /dev/null +++ b/basis/tools/deploy/test/test.factor @@ -0,0 +1,19 @@ +USING: accessors arrays continuations io.directories io.files.info +io.files.temp io.launcher kernel layouts math sequences system +tools.deploy.backend tools.deploy.config.editor ; +IN: tools.deploy.test + +: shake-and-bake ( vocab -- ) + [ "test.image" temp-file delete-file ] ignore-errors + "resource:" [ + [ vm "test.image" temp-file ] dip + dup deploy-config make-deploy-image + ] with-directory ; + +: small-enough? ( n -- ? ) + [ "test.image" temp-file file-info size>> ] [ cell 4 / * ] bi* <= ; + +: run-temp-image ( -- ) + vm + "-i=" "test.image" temp-file append + 2array try-process ; \ No newline at end of file From d6e7eefde32de78b7db041becf1b156e32fb23f2 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 14 Jan 2009 01:02:27 -0600 Subject: [PATCH 2/2] Fix mnestic's bug and remove math.complex.prettyprint hack --- basis/bootstrap/math/math.factor | 4 +--- basis/math/complex/complex.factor | 8 +++++++- basis/math/complex/prettyprint/prettyprint.factor | 8 -------- 3 files changed, 8 insertions(+), 12 deletions(-) delete mode 100644 basis/math/complex/prettyprint/prettyprint.factor diff --git a/basis/bootstrap/math/math.factor b/basis/bootstrap/math/math.factor index 347969af0d..27b2f6b181 100644 --- a/basis/bootstrap/math/math.factor +++ b/basis/bootstrap/math/math.factor @@ -2,6 +2,4 @@ USING: vocabs vocabs.loader kernel ; "math.ratios" require "math.floats" require -"math.complex" require - -"prettyprint" vocab [ "math.complex.prettyprint" require ] when +"math.complex" require \ No newline at end of file diff --git a/basis/math/complex/complex.factor b/basis/math/complex/complex.factor index 90713cd40f..620a6c3bab 100644 --- a/basis/math/complex/complex.factor +++ b/basis/math/complex/complex.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2006, 2008 Slava Pestov. +! Copyright (C) 2006, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors kernel kernel.private math math.private math.libm math.functions arrays math.functions.private sequences @@ -47,3 +47,9 @@ M: complex sqrt >polar [ fsqrt ] [ 2.0 / ] bi* polar> ; IN: syntax : C{ \ } [ first2 rect> ] parse-literal ; parsing + +USE: prettyprint.custom + +M: complex pprint* pprint-object ; +M: complex pprint-delims drop \ C{ \ } ; +M: complex >pprint-sequence >rect 2array ; \ No newline at end of file diff --git a/basis/math/complex/prettyprint/prettyprint.factor b/basis/math/complex/prettyprint/prettyprint.factor deleted file mode 100644 index 09eeb8045c..0000000000 --- a/basis/math/complex/prettyprint/prettyprint.factor +++ /dev/null @@ -1,8 +0,0 @@ -! Copyright (C) 2008 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: math math.functions arrays prettyprint.custom kernel ; -IN: math.complex.prettyprint - -M: complex pprint* pprint-object ; -M: complex pprint-delims drop \ C{ \ } ; -M: complex >pprint-sequence >rect 2array ;