chiark / gitweb /
[PATCH] add tests for NAME="foo-%c{N}"
[elogind.git] / test / udev-test.pl
index a3bf768fe3d1d71cd69c6a4781e62620c3150ff4..60cf16901c13d90a3daf668e1ed013d62241975d 100644 (file)
@@ -191,6 +191,15 @@ EOF
                expected => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" ,
                conf     => <<EOF
 BUS="scsi", PLACE="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b"
+EOF
+       },
+       {
+               desc     => "test NAME substitution chars (with length limit)",
+               subsys   => "block",
+               devpath  => "block/sda/sda3",
+               expected => "M8-m3-n3-b0:0-sIBM" ,
+               conf     => <<EOF
+BUS="scsi", PLACE="0:0:0:0", NAME="M%M-m%m-n%n-b%3b-s%3s{vendor}"
 EOF
        },
        {
@@ -250,6 +259,24 @@ EOF
                expected => "foo9" ,
                conf     => <<EOF
 BUS="scsi", PROGRAM="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL="sda3", NAME="%c{7}"
+EOF
+       },
+       {
+               desc     => "characters before the %c{N} substitution",
+               subsys   => "block",
+               devpath  => "block/sda/sda3",
+               expected => "my-foo9" ,
+               conf     => <<EOF
+BUS="scsi", PROGRAM="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL="sda3", NAME="my-%c{7}"
+EOF
+       },
+       {
+               desc     => "substitute the second to last argument",
+               subsys   => "block",
+               devpath  => "block/sda/sda3",
+               expected => "my-foo8" ,
+               conf     => <<EOF
+BUS="scsi", PROGRAM="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL="sda3", NAME="my-%c{6}"
 EOF
        },
        {