Fixing identation in advice-tests
parent
d9076407fb
commit
cc877bf79b
|
@ -1,26 +1,32 @@
|
||||||
! Copyright (C) 2008 James Cash
|
! Copyright (C) 2008 James Cash
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel sequences math tools.test advice parser namespaces ;
|
USING: kernel sequences io io.streams.string math tools.test advice math.parser
|
||||||
|
parser namespaces multiline eval words assocs ;
|
||||||
IN: advice.tests
|
IN: advice.tests
|
||||||
|
|
||||||
[
|
[
|
||||||
: foo "foo" ;
|
[ ad-do-it ] must-fail
|
||||||
\ foo make-advised
|
|
||||||
|
: foo "foo" ;
|
||||||
|
\ foo make-advised
|
||||||
|
|
||||||
{ "bar" "foo" } [
|
{ "bar" "foo" } [
|
||||||
[ "bar" ] "barify" \ foo advise-before
|
[ "bar" ] "barify" \ foo advise-before
|
||||||
foo ] unit-test
|
foo
|
||||||
|
] unit-test
|
||||||
|
|
||||||
{ "bar" "foo" "baz" } [
|
{ "bar" "foo" "baz" } [
|
||||||
[ "baz" ] "bazify" \ foo advise-after
|
[ "baz" ] "bazify" \ foo advise-after
|
||||||
foo ] unit-test
|
foo
|
||||||
|
] unit-test
|
||||||
|
|
||||||
{ "foo" "baz" } [
|
{ "foo" "baz" } [
|
||||||
"barify" \ foo before remove-advice
|
"barify" \ foo before remove-advice
|
||||||
foo ] unit-test
|
foo
|
||||||
|
] unit-test
|
||||||
|
|
||||||
: bar ( a -- b ) 1+ ;
|
: bar ( a -- b ) 1+ ;
|
||||||
\ bar make-advised
|
\ bar make-advised
|
||||||
|
|
||||||
{ 11 } [
|
{ 11 } [
|
||||||
[ 2 * ] "double" \ bar advise-before
|
[ 2 * ] "double" \ bar advise-before
|
||||||
|
@ -37,8 +43,8 @@ IN: advice.tests
|
||||||
5 bar
|
5 bar
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
: add ( a b -- c ) + ;
|
: add ( a b -- c ) + ;
|
||||||
\ add make-advised
|
\ add make-advised
|
||||||
|
|
||||||
{ 10 } [
|
{ 10 } [
|
||||||
[ [ 2 * ] bi@ ] "double-args" \ add advise-before
|
[ [ 2 * ] bi@ ] "double-args" \ add advise-before
|
||||||
|
@ -55,10 +61,33 @@ IN: advice.tests
|
||||||
2 3 add
|
2 3 add
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{ 5 } [
|
{ { "around1" "around2" } } [
|
||||||
\ add unadvise
|
\ add around word-prop keys
|
||||||
2 3 add
|
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
{ 5 f } [
|
||||||
|
\ add unadvise
|
||||||
|
2 3 add \ add advised?
|
||||||
|
] unit-test
|
||||||
|
|
||||||
] with-scope
|
: quux ( a b -- c ) * ;
|
||||||
|
|
||||||
|
{ f t 3+3/4 } [
|
||||||
|
<" USING: advice kernel math ;
|
||||||
|
IN: advice.tests
|
||||||
|
\ quux advised?
|
||||||
|
ADVISE: quux halve before [ 2 / ] bi@ ;
|
||||||
|
\ quux advised?
|
||||||
|
3 5 quux"> eval
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
{ 3+3/4 "1+1/2 2+1/2 3+3/4" } [
|
||||||
|
<" USING: advice kernel math math.parser io io.streams.string ; IN: advice.tests
|
||||||
|
ADVISE: quux log around
|
||||||
|
2dup [ number>string write " " write ] bi@
|
||||||
|
ad-do-it
|
||||||
|
dup number>string write ;
|
||||||
|
[ 3 5 quux ] with-string-writer"> eval
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
] with-scope
|
Loading…
Reference in New Issue