From 2d1481ce953a869b129bf2c98d7c084d7180f8a3 Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Wed, 18 Dec 2019 15:52:21 -0500 Subject: tested search and file functions; fixed relevant bugs --- tests/space_file.js | 14 ++++++++++++++ tests/space_search.js | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tests/space_file.js create mode 100644 tests/space_search.js (limited to 'tests') diff --git a/tests/space_file.js b/tests/space_file.js new file mode 100644 index 0000000..84e42a3 --- /dev/null +++ b/tests/space_file.js @@ -0,0 +1,14 @@ +// Tests Space.{to,from}file +const space = require('../space') + +text = new space.Space(); + +text.adhoc('\ +line of text\n\ +other&&\\\\&&line of text\n\ +\n\ +final\n'); + +text.tofile('local') +text.fromfile('local') +console.log(text.print()); //Should be losslessly transmitted, and local contains a copy diff --git a/tests/space_search.js b/tests/space_search.js new file mode 100644 index 0000000..fffdcc7 --- /dev/null +++ b/tests/space_search.js @@ -0,0 +1,16 @@ +// Tests space.search + +const space = require('../space') + +let text = new space.Space(); +text.adhoc('\ +\n\ + jarvis\n\ + jarvis\n\ + jarvis \ +'); + +let line = new space.Space(); +line.adhoc('jarvis'); + +console.log(text.search(line)) -- cgit