]> gitweb.factorcode.org Git - factor.git/commitdiff
google.charts: fix tests, add comments
authorAlexander Iljin <ajsoft@yandex.ru>
Sat, 24 Dec 2016 23:24:13 +0000 (02:24 +0300)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 25 Dec 2016 19:42:49 +0000 (11:42 -0800)
extra/google/charts/charts-tests.factor

index 6dd9c7640fc9eb56f97bb4620b0914d3f6774a5f..efa9694bca723c1d28a9980905384be638542f1b 100644 (file)
@@ -4,39 +4,45 @@ USING: accessors colors.constants google.charts
 google.charts.private kernel math present sequences tools.test ;
 IN: google.charts.tests
 
-{ t } [
+! 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.
 
-    { 0 0 } <line>
-    { 0 0 } <line> COLOR: red >>background
-    [ chart>url present length ] bi@ <
+{ t } [
+    "" <formula> t >>data-scale
+    "" <formula>
+    [ chart>url present length ] bi@ >
 ] unit-test
 
 { t } [
     { 0 0 } <line>
-    { 0 0 } <line> COLOR: red >>foreground
-    [ chart>url present length ] bi@ <
+    { 0 0 } <line> f >>width f >>height
+    [ chart>url present length ] bi@ >
 ] unit-test
 
 { t } [
-    "" <formula>
-    "" <formula> t >>data-scale
-    [ chart>url present length ] bi@ <
+    { 0 0 } <line> COLOR: red >>background
+    { 0 0 } <line>
+    [ chart>url present length ] bi@ >
 ] unit-test
 
 { t } [
+    { 0 0 } <line> COLOR: red >>foreground
     { 0 0 } <line>
-    { 0 0 } <line> f >>width f >>height
     [ chart>url present length ] bi@ >
 ] unit-test
 
 { t } [
-    { 0 0 } <line>
     { 0 0 } <line> { 0 0 } >>margin
-    [ chart>url present length ] bi@ <
+    { 0 0 } <line>
+    [ chart>url present length ] bi@ >
 ] unit-test
 
 { t } [
-    { 0 0 } <line>
     { 0 0 } <line> 5 >>bar-width
-    [ chart>url present length ] bi@ <
+    { 0 0 } <line>
+    [ chart>url present length ] bi@ >
 ] unit-test