mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-16 04:36:02 +00:00
00_parseParams.t: first version (from justme1968)
git-svn-id: https://svn.fhem.de/fhem/trunk@21938 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
963c73df78
commit
9116ce5d3a
27
fhem/t/FHEM/fhem.pl/00_parseParams.t
Normal file
27
fhem/t/FHEM/fhem.pl/00_parseParams.t
Normal file
@ -0,0 +1,27 @@
|
||||
# Simple test. NOTE: exit(0) is necessary
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More;
|
||||
|
||||
my $cmd = 'set name test1 test2=abc test3 "test4 test4" test5="test5 test5" test6=\'test6=test6\' test7= test8="\'" test9=\'"\' {my $x = "abc"} test10={ { my $abc ="xyz" } }';
|
||||
|
||||
my $expected_a = [ 'set', 'name', 'test1', 'test3', 'test4 test4', '{my $x = "abc"}' ];
|
||||
my $expected_h = {
|
||||
'test2' => 'abc',
|
||||
'test5' => 'test5 test5',
|
||||
'test6' => 'test6=test6',
|
||||
'test7' => '',
|
||||
'test8' => '\'',
|
||||
'test9' => '"',
|
||||
'test10' => '{ { my $abc ="xyz" } }'
|
||||
};
|
||||
|
||||
|
||||
my ($a,$h) = parseParams( $cmd );
|
||||
|
||||
is_deeply($h, $expected_h, "parseParams hash");
|
||||
is_deeply($a, $expected_a, "parseParams array");
|
||||
|
||||
done_testing;
|
||||
exit(0);
|
||||
1;
|
Loading…
x
Reference in New Issue
Block a user