core: change globals to vars in test

This commit is contained in:
hellerve 2018-02-23 17:25:15 +01:00
parent b8e1784a00
commit 619089aead

View File

@ -1,5 +1,5 @@
(defmodule IO
(defn color-table []
(def color-table
[[@"black" @"30"]
[@"red" @"31"]
[@"green" @"32"]
@ -24,14 +24,14 @@
[@"bg-cyan" @"46"]
[@"bg-white" @"47"]])
(def len-color-table 23) ; should be a count-macro
(def len-color-table (Array.count &color-table))
(defn color-name-to-ansi [cname]
(let [res @""]
(do
(for [i 0 len-color-table]
(if (String.= cname (Array.nth (Array.nth &(color-table) i) 0))
(set! res @(Array.nth (Array.nth &(color-table) i) 1))
(if (String.= cname (Array.nth (Array.nth &color-table i) 0))
(set! res @(Array.nth (Array.nth &color-table i) 1))
()))
(String.append @"\x1b[" (String.append res @"m")))))