File: string_rb_simple_2_lines.sh

package info (click to toggle)
liblognorm 2.0.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,696 kB
  • sloc: ansic: 11,634; sh: 2,639; makefile: 255; python: 34
file content (25 lines) | stat: -rwxr-xr-x 637 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
# This file is part of the liblognorm project, released under ASL 2.0

. $srcdir/exec.sh

test_def $0 "simple rulebase via string"
execute_with_string 'rule=:%w:word%
rule=:%n:number%' 'test'
assert_output_json_eq '{ "w": "test" }'

execute_with_string 'rule=:%w:word%
rule=:%n:number%' '2'
assert_output_json_eq '{ "n": "2" }'

#This is a correct word...
execute_with_string 'rule=:%w:word%
rule=:%n:number%' '2.3'
assert_output_json_eq '{ "w": "2.3" }'

#check error case
execute_with_string 'rule=:%w:word%
rule=:%n:number%' '2 3'
assert_output_json_eq '{ "originalmsg": "2 3", "unparsed-data": " 3" }'

cleanup_tmp_files