Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix XDG tests on Windows #4779

Merged
merged 4 commits into from
Aug 21, 2023
Merged

Fix XDG tests on Windows #4779

merged 4 commits into from
Aug 21, 2023

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Aug 21, 2023

Description

  • Fixes tests not compiling on Windows and macOS.
  • Removes unused includes in XDG files (→ this should be done on Windows only code as well).

@pajlada
Copy link
Member

pajlada commented Aug 21, 2023

Could we not just ifdef the tests out on Windows?

diff --git a/tests/src/XDGDesktopFile.cpp b/tests/src/XDGDesktopFile.cpp
index 171ac9f2..787cb947 100644
--- a/tests/src/XDGDesktopFile.cpp
+++ b/tests/src/XDGDesktopFile.cpp
@@ -5,6 +5,8 @@
 
 using namespace chatterino;
 
+#if defined(Q_OS_UNIX) and !defined(Q_OS_DARWIN)
+
 TEST(XDGDesktopFile, String)
 {
     auto desktopFile = XDGDesktopFile(":/001-mimeapps.list");
@@ -17,3 +19,5 @@ TEST(XDGDesktopFile, String)
 
     ASSERT_EQ(desktopFile.getEntries("test").size(), 2);
 }
+
+#endif
diff --git a/tests/src/XDGHelper.cpp b/tests/src/XDGHelper.cpp
index e142697b..580a45e8 100644
--- a/tests/src/XDGHelper.cpp
+++ b/tests/src/XDGHelper.cpp
@@ -5,6 +5,8 @@
 
 using namespace chatterino;
 
+#if defined(Q_OS_UNIX) and !defined(Q_OS_DARWIN)
+
 TEST(XDGHelper, ParseDesktopExecProgram)
 {
     struct TestCase {
@@ -60,3 +62,5 @@ TEST(XDGHelper, ParseDesktopExecProgram)
             << output.toStdString() << "'";
     }
 }
+
+#endif

@Nerixyz
Copy link
Contributor Author

Nerixyz commented Aug 21, 2023

Could we not just ifdef the tests out on Windows and macOS?

Yes

Copy link
Member

@pajlada pajlada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undo the ifdef moves in the src/util/XDG*.* files, or change the ifdefs of all src/util/XDG*.* to consistently be

#include ...

#ifdef

namespace chatterino {
...
}

#endif

@Nerixyz
Copy link
Contributor Author

Nerixyz commented Aug 21, 2023

Undo the ifdef moves in the src/util/XDG*.* files

I can't do that for the XDGDesktopFile.hpp file, because the chatterino namespace has to be known in the tests.

@pajlada pajlada changed the title Fix XDG tests and includes Fix XDG tests on Windows Aug 21, 2023
@pajlada pajlada enabled auto-merge (squash) August 21, 2023 16:08
@pajlada pajlada merged commit ea30c3a into Chatterino:master Aug 21, 2023
15 of 17 checks passed
@Nerixyz Nerixyz deleted the fix/windows-xdg branch August 21, 2023 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants