From b2709eeb419eef22a889b07eaafd2867b37e28a6 Mon Sep 17 00:00:00 2001 From: Alexander Iljin Date: Sun, 25 Dec 2016 02:24:13 +0300 Subject: [PATCH] google.charts: fix tests, add comments --- extra/google/charts/charts-tests.factor | 42 ++++++++++++++----------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/extra/google/charts/charts-tests.factor b/extra/google/charts/charts-tests.factor index 6dd9c7640f..efa9694bca 100644 --- a/extra/google/charts/charts-tests.factor +++ b/extra/google/charts/charts-tests.factor @@ -4,23 +4,17 @@ USING: accessors colors.constants google.charts google.charts.private kernel math present sequences tools.test ; IN: google.charts.tests -{ t } [ - - { 0 0 } - { 0 0 } COLOR: red >>background - [ chart>url present length ] bi@ < -] unit-test +! The order of the constructors below is important, because we +! are testing side-effects. If you remove the clone word from +! chart>url implementation, the second object in each test +! will incorrectly result in the same URL as the first one +! (although the order of parameters in the URL may vary). +! The order of tests is important for the same reason. { t } [ - { 0 0 } - { 0 0 } COLOR: red >>foreground - [ chart>url present length ] bi@ < -] unit-test - -{ t } [ - "" "" t >>data-scale - [ chart>url present length ] bi@ < + "" + [ chart>url present length ] bi@ > ] unit-test { t } [ @@ -30,13 +24,25 @@ IN: google.charts.tests ] unit-test { t } [ + { 0 0 } COLOR: red >>background { 0 0 } - { 0 0 } { 0 0 } >>margin - [ chart>url present length ] bi@ < + [ chart>url present length ] bi@ > ] unit-test { t } [ + { 0 0 } COLOR: red >>foreground { 0 0 } - { 0 0 } 5 >>bar-width - [ chart>url present length ] bi@ < + [ chart>url present length ] bi@ > +] unit-test + +{ t } [ + { 0 0 } { 0 0 } >>margin + { 0 0 } + [ chart>url present length ] bi@ > +] unit-test + +{ t } [ + { 0 0 } 5 >>bar-width + { 0 0 } + [ chart>url present length ] bi@ > ] unit-test