mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
TW-1736: Error on detection of BOM in files.
This commit is contained in:
parent
92f22149c0
commit
19f57ffead
5 changed files with 71 additions and 1 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <cmake.h>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <stdlib.h>
|
||||
#include <Context.h>
|
||||
#include <FS.h>
|
||||
|
@ -35,7 +36,7 @@ Context context;
|
|||
|
||||
int main (int, char**)
|
||||
{
|
||||
UnitTest t (112);
|
||||
UnitTest t (116);
|
||||
|
||||
// Ensure environment has no influence.
|
||||
unsetenv ("TASKDATA");
|
||||
|
@ -291,6 +292,19 @@ int main (int, char**)
|
|||
tmp.remove ();
|
||||
t.notok (tmp.exists (), "tmp dir removed.");
|
||||
|
||||
// File::removeBOM
|
||||
std::string line = "Should not be modified.";
|
||||
t.is (File::removeBOM (line), line, "File::removeBOM 'Should not be modified' --> 'Should not be modified'");
|
||||
|
||||
line = "no";
|
||||
t.is (File::removeBOM (line), line, "File::removeBOM 'no' --> 'no'");
|
||||
|
||||
line = "";
|
||||
t.is (File::removeBOM (line), line, "File::removeBOM '' --> ''");
|
||||
|
||||
line = {'\xEF', '\xBB', '\xBF', 'F', 'o', 'o'};
|
||||
t.is (File::removeBOM (line), "Foo", "File::removeBOM '<BOM>Foo' --> 'Foo'");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue