From 4370b6e89b89fcbfe45b9160f833b8438e03ad39 Mon Sep 17 00:00:00 2001 From: dig Date: Sun, 26 Sep 2021 16:20:27 +0200 Subject: [PATCH] WIP of tests --- tests-browser.js | 29 +++++++++++++++++++++++++++++ tests-esmodule.js | 8 ++++++++ tests-node.js | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 tests-browser.js create mode 100644 tests-esmodule.js create mode 100644 tests-node.js diff --git a/tests-browser.js b/tests-browser.js new file mode 100644 index 0000000..575a3ef --- /dev/null +++ b/tests-browser.js @@ -0,0 +1,29 @@ + +log ` +window = ${window}o +innerHeight = ${`color:blue`}c${window.innerHeight}d${``}cpx +${`color:white;background:green`}cOK` + +log.I ` +Hello ${window}o, tu est grande de ${`color:blue`}c${window.innerHeight}d${``}c pixels ! +${`color:green`}c Bravo!!` + +log.E ` +Hello ${window}o tu est grande que de ${window.innerHeight}d pixels ! +${`color:white;background:red`}c Pas bien!!` + +var bigreen = `color:white;background:green;font-size:1.2em;padding:0 .3em` + , bigred = `color:white;background:red;font-size:1.2em;padding:0 .3em` +log `${bigreen}cOK` +log `${bigred}cKO` +log `${window.innerHeight<500 ? bigred : bigreen}c${window.innerHeight<500 ? "trop petiiiiit!s" : "Ok mon grand .."}s` + +// var toLog = window; +// log.G`[class ${'color: indigo'}c${toLog.constructor.name}s${''}c] +// this = ${window}o +// innerWidth = ${`color:blue`}c${window.innerWidth}d${``}cpx +// innerHeight = ${`color:blue`}c${window.innerHeight}d${``}cpx +// document = ${document}o +// title = ${`color:white;background:indigo`}c"${document.title}s"${``}c +// ` + diff --git a/tests-esmodule.js b/tests-esmodule.js new file mode 100644 index 0000000..444e6a9 --- /dev/null +++ b/tests-esmodule.js @@ -0,0 +1,8 @@ +import log from '.' +import { I: info, E: error, W: warn } from '.' + + +//let { I: info, E: error, W: warn } = log + + +log `OK` diff --git a/tests-node.js b/tests-node.js new file mode 100644 index 0000000..b543e1f --- /dev/null +++ b/tests-node.js @@ -0,0 +1,40 @@ +require('.') + +var window = {title: 'window stub'} + +log `Simple log` +log.S `Success` +log.W `Warning` +log.I `Info` +log.E `Error` +//log.G + + +log ` +window = ${window}o +innerHeight = ${`color:blue`}c${window.innerHeight}d${``}cpx +${`color:white;background:green`}cOK` + +log.I ` +Hello ${window}o, tu est grande de ${`color:blue`}c${window.innerHeight}d${``}c pixels ! +${`color:green`}c Bravo!!` + +log.E ` +Hello ${window}o tu est grande que de ${window.innerHeight}d pixels ! +${`color:white;background:red`}c Pas bien!!` + +var bigreen = `color:white;background:green;font-size:1.2em;padding:0 .3em` + , bigred = `color:white;background:red;font-size:1.2em;padding:0 .3em` +log `${bigreen}cOK` +log `${bigred}cKO` +log `${window.innerHeight<500 ? bigred : bigreen}c${window.innerHeight<500 ? "trop petiiiiit!s" : "Ok mon grand .."}s` + +// var toLog = window; +// log.G`[class ${'color: indigo'}c${toLog.constructor.name}s${''}c] +// this = ${window}o +// innerWidth = ${`color:blue`}c${window.innerWidth}d${``}cpx +// innerHeight = ${`color:blue`}c${window.innerHeight}d${``}cpx +// document = ${document}o +// title = ${`color:white;background:indigo`}c"${document.title}s"${``}c +// ` +