Skip to content

Commit 213137d

Browse files
committed
test: cover all features
Signed-off-by: Ryan Graham <[email protected]>
1 parent d2675b8 commit 213137d

12 files changed

+45
-6
lines changed

test/fixtures/json-timestamp.grep

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
^\{"msg":"one","time":"[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]+Z"\}$
2+
^\{"msg":"two","time":"[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]+Z"\}$
3+
^\{"msg":"three","time":"[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]+Z"\}$
4+
^\{"msg":"four","time":"[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]+Z"\}$

test/fixtures/text-object-tagged.out

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
one:1 two:2 one
2+
one:1 two:2 two
3+
one:1 two:2 three
4+
one:1 two:2 four

test/fixtures/text-timestamp.grep

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]+Z one$
2+
^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]+Z two$
3+
^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]+Z three$
4+
^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]+Z four$

test/test-basic.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
set -e
32

43
cd $(dirname "${BASH_SOURCE[0]}")
54
source common.sh

test/test-help.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
set -e
32

43
cd $(dirname "${BASH_SOURCE[0]}")
54
source common.sh

test/test-json-timestamp.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
cd $(dirname "${BASH_SOURCE[0]}")
4+
source common.sh
5+
6+
mkdir -p sandbox
7+
node ../bin/sl-log-transformer.js --timeStamp --format=json < fixtures/basic.in > sandbox/json-timestamp.test
8+
9+
# timestamps are real so we have a regex-per-line filter
10+
grep -E -f fixtures/json-timestamp.grep sandbox/json-timestamp.test > sandbox/json-timestamp.matched
11+
12+
assert_exit 0 diff -u sandbox/json-timestamp.matched sandbox/json-timestamp.test

test/test-json.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
set -e
32

43
cd $(dirname "${BASH_SOURCE[0]}")
54
source common.sh

test/test-lineMerge.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
set -e
32

43
cd $(dirname "${BASH_SOURCE[0]}")
54
source common.sh

test/test-stringTag.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
set -e
32

43
cd $(dirname "${BASH_SOURCE[0]}")
54
source common.sh

test/test-text-tag-object.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
cd $(dirname "${BASH_SOURCE[0]}")
4+
source common.sh
5+
6+
mkdir -p sandbox
7+
node ../bin/sl-log-transformer.js --tag.one 1 --tag.two 2 < fixtures/basic.in > sandbox/text-object-tagged.test
8+
9+
assert_exit 0 diff -u fixtures/text-object-tagged.out sandbox/text-object-tagged.test

0 commit comments

Comments
 (0)