]> gitweb.factorcode.org Git - factor.git/commitdiff
google.charts: fix side-effects of set-query-param, add tests
authorAlexander Iljin <ajsoft@yandex.ru>
Tue, 13 Dec 2016 13:41:38 +0000 (16:41 +0300)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 21 Dec 2016 23:21:16 +0000 (15:21 -0800)
extra/google/charts/charts-tests.factor [new file with mode: 0644]
extra/google/charts/charts.factor

diff --git a/extra/google/charts/charts-tests.factor b/extra/google/charts/charts-tests.factor
new file mode 100644 (file)
index 0000000..cd3a7ee
--- /dev/null
@@ -0,0 +1,35 @@
+! Copyright (C) 2016 Alexander Ilin.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors colors.constants google.charts
+google.charts.private kernel present sequences tools.test ;
+IN: google.charts.tests
+
+[ f ] [
+    { 0 0 } <line> COLOR: red >>background chart>url present length
+    { 0 0 } <line> chart>url present length =
+] unit-test
+
+[ f ] [
+    { 0 0 } <line> COLOR: red >>foreground chart>url present length
+    { 0 0 } <line> chart>url present length =
+] unit-test
+
+[ f ] [
+    "" <formula> t >>data-scale chart>url present length
+    "" <formula> chart>url present length =
+] unit-test
+
+[ f ] [
+    { 0 0 } <line> f >>width f >>height chart>url present length
+    { 0 0 } <line> chart>url present length =
+] unit-test
+
+[ f ] [
+    { 0 0 } <line> { 0 0 } >>margin chart>url present length
+    { 0 0 } <line> chart>url present length =
+] unit-test
+
+[ f ] [
+    { 0 0 } <line> 5 >>bar-width chart>url present length
+    { 0 0 } <line> chart>url present length =
+] unit-test
index d97a97bceb1ffaf1e620c01dd6abed32feda0016..28d40b82404641776879236c9bc8eed77575bd16 100644 (file)
@@ -71,7 +71,7 @@ PRIVATE>
 <PRIVATE
 
 : chart>url ( chart -- url )
-    [ URL" http://chart.googleapis.com/chart" ] dip {
+    [ URL" http://chart.googleapis.com/chart" clone ] dip {
         [ type>> "cht" set-query-param ]
         [
             [ width>> ] [ height>> ] bi 2dup and [