D12806: CoreFileTest

Johnny Jazeix noreply at phabricator.kde.org
Thu May 10 15:45:32 UTC 2018


jjazeix added a comment.


  Don't forget to also test the sanitizeUrl method.

INLINE COMMENTS

> FileTest.cpp:47
> +    file.setName(name);
> +    QVERIFY(File::exists(name));
> +    QVERIFY(File::mkpath(QStringLiteral("./make/dummy/path")));

I'm not sure the file exists just by settings its name. You should at least write in it before

> FileTest.cpp:51
> +    QCOMPARE(file.write(QStringLiteral("How are you??")), true);
> +    QCOMPARE(file.read(), QStringLiteral("How are you??"));
> +}

you should remove the created files at the end of the test, to be sure it does not impact the next tests and each are independant

> FileTest.cpp:58
> +
> +    QString fileContaint = QStringLiteral("this is going to test the class File in the core");
> +    QSignalSpy spyError(&file, &File::error);

fileContent

> FileTest.cpp:61
> +    QVERIFY(spyError.count() == 0);
> +    // File object does not having file name
> +    QVERIFY(!file.write(fileContaint));

The file is missing a filename

> FileTest.cpp:63
> +    QVERIFY(!file.write(fileContaint));
> +    QVERIFY(spyError.count() == 1);
> +    QVERIFY(file.write(fileContaint, "./dummy_test_files.txt"));

can you also check the content of the error here?

REPOSITORY
  R2 GCompris

REVISION DETAIL
  https://phabricator.kde.org/D12806

To: himanshuvishwakarma, jjazeix
Cc: kde-edu, #gcompris, himanshuvishwakarma, harrymecwan, ganeshredcobra, nityanandkumar, echarruau, rahulyadav, narvaez, scagarwal, apol, timotheegiet, hkaelberer, jjazeix, bcoudoin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20180510/f73f2842/attachment-0001.html>


More information about the kde-edu mailing list