以下代码非常简单,我希望它应该编译好.
struct A
{
struct B
{
int i = 0;
};
B b;
A(const B& _b = B())
: b(_b)
{}
};
Run Code Online (Sandbox Code Playgroud)
我用g ++版本4.7.2,4.8.1,clang ++ 3.2和3.3测试了这段代码.除了g ++ 4.7.2对此代码的段错误(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57770)之外,其他经过测试的编译器提供的错误消息并不能解释太多.
g ++ 4.8.1:
test.cpp: In constructor ‘constexpr A::B::B()’:
test.cpp:3:12: error: constructor required before non-static data member for ‘A::B::i’ has been parsed
struct B
^
test.cpp: At global scope:
test.cpp:11:23: note: synthesized method ‘constexpr A::B::B()’ first required here
A(const B& _b = B())
^
Run Code Online (Sandbox Code Playgroud)
clang ++ 3.2和3.3:
test.cpp:11:21: error: defaulted …Run Code Online (Sandbox Code Playgroud) 在虚拟机(干净,新鲜的Ubuntu服务器11.04)上,我创建了一个测试网站,如创建您的第一个Yii应用程序中所述,现在我想使用webdriver-test创建简单的测试.
我在protected/tests/WebTestCase.php中设置了正确的TEST_BASE_URL并创建了protected/tests/functional/MySimpleTest.php
<?php
Yii::import( 'ext.webdriver-bindings.CWebDriverTestCase' );
class MySimpleTest extends CWebDriverTestCase {
protected function setUp() {
parent::setUp( '192.168.57.1', 4444, 'firefox' );
}
public function testMySite() {
$this->get( TEST_BASE_URL );
$qElem = $this->findElementBy( LocatorStrategy::linkText, 'Users' );
$this->assertNotNull( $qElem, 'There is no "Users" link!' );
$qElem->clickAndWait();
$this->assertTrue( $this->isTextPresent( 'test1@example.com' ), 'The is no "test1@example.com" text on result page!' );
}
}
Run Code Online (Sandbox Code Playgroud)
运行它看起来像这样:
etam@ubuntu:/var/www/test/protected/tests$ phpunit functional/MySimpleDbTest.php
PHPUnit 3.5.15 by Sebastian Bergmann.
E
Time: 5 seconds, Memory: 5.25Mb
There …Run Code Online (Sandbox Code Playgroud)