English 中文(简体)
Dejagnu/expect multiline regex
原标题:Dejagnu/expect multiline regex

我在DejaGNU的手表上进行一米写作单位测试,我可以调和 mu光输出。

When I remove newline from output, my rules matches well. Eg.

页: 1

expect {
  -re "^0 \d+ 0 \d+$" {pass "$test_name"}
}

我希望产出如下:

0 123
0 123

我曾尝试过任何事

"^0 \d+\n0 \d+$"
"^0 \d+
0 \d+$"
"^0 \d+$\n^0 \d+$"
"^0 \d+$
^0 \d+$"

但是,他们当中没有工作。

最佳回答

具体来说,总体的多线模式的确有相应的空间,但并不一定能看到你重新思考。 尤其是,新线路最终可以由虚拟终端系统改造。 引证:

expect {
    -re {^0 d+[
]{1,2}0 d+$} {
        # Just for debugging (and you might need to write to a log...)
        binary scan $expect_out(0,string) c* byteList
        puts [join $byteList ","]
        # Now do the rest of your code
        pass "$test_name"
    }
}

Note that I put the RE in braces instead of double quotes, because that keeps the number of backslashes down.
Once you know what s actually being seen by Expect, you can code it more directly. I d normally just say print it out without any fussing around, but since you re dealing with newlines it s easier to read the ASCII bytes.

问题回答

暂无回答




相关问题
run unit tests and coverage in certain python structure

I have some funny noob problem. I try to run unit tests from commandline: H:PROpyEstimator>python src estpython est_power_estimator.py Traceback (most recent call last): File "src est...

How to unit-test an enterprise symfony project?

I´m working on a huge project at my work. We have about 200 database tables, accordingly a huge number of Models, Actions and so on. How should I begin to write tests for this? My biggest problem ...

Code Coverage Tools & Visual Studio 2008 Pro

Just wondering what people are using for code coverage tools when using MS Visual Studio 2008 Pro. We are using the built-in MS test project and unit testing tool (the one that come pre-installed ...

Unit testing. File structure

I have a C++ legacy codebase with 10-15 applications, all sharing several components. While setting up unittests for both shared components and for applications themselves, I was wondering if there ...

Unit Testing .NET 3.5 projects using MStest in VS2010

There s a bug/feature in Visual Studio 2010 where you can t create a unit test project with the 2.0 CLR. https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=483891&wa=...

Unit Test for Exceptions Message

Is there a simple (Attribute-driven) way to have the following test fail on the message of the exception. [TestMethod()] [ExpectedException(typeof(ArgumentException))] public void ExceptionTestTest() ...

热门标签