mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
00_parseParams.t: first version (from justme1968)
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@21938 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
fea48c0451
commit
91681e4bbc
27
t/FHEM/fhem.pl/00_parseParams.t
Normal file
27
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