This repository was archived by the owner on Sep 3, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +51
-18
lines changed
Expand file tree Collapse file tree 7 files changed +51
-18
lines changed Original file line number Diff line number Diff line change 1- name : Coverage Testing
1+ name : Coverage Testing on public beta of Ubuntu 24.04
22
33on :
44 push :
1212
1313jobs :
1414 coverage-test :
15- runs-on : ubuntu-latest
15+ runs-on : ubuntu-24.04
1616 steps :
17- - uses : actions/checkout@v3
17+ - uses : actions/checkout@v4
1818 - name : configure
1919 run : ./configure --enable-code-coverage
2020 - name : build
Original file line number Diff line number Diff line change 1212
1313jobs :
1414 unit-test :
15+ continue-on-error : true
1516 strategy :
1617 matrix :
17- os : [macos-latest, ubuntu-latest]
18+ os : [ macos-latest, ubuntu-latest, ubuntu-24.04 ]
1819 runs-on : ${{ matrix.os }}
1920 steps :
20- - uses : actions/checkout@v3
21+ - uses : actions/checkout@v4
2122 - name : Install GNU Getopt on macOS
2223 if : ${{ matrix.os == 'macos-latest' }}
23- run : |
24- brew install gnu-getopt
24+ run : brew install gnu-getopt
2525 - name : configure
2626 run : ./configure
2727 - name : build
Original file line number Diff line number Diff line change 3333
3434## Prerequisites
3535
36+ The following versions or newer are required.
37+
3638for building
3739
38- * GNU getopt - 2.37.2 or later
39- * GNU Make - 4.3 or later
40- * GCC - 11.3 .0 or later
40+ * GNU getopt - 2.37.2
41+ * GNU Make - 4.3
42+ * GCC - 13.2 .0 or Clang - 15.0.0
4143
4244for macOS, You can install gnu-getopt by runnning the following command.
43- ```
45+ ``` bash
4446$ brew install gnu-getopt
4547```
4648
4749for generating API documents
4850
49- * Doxygen - 1.9.1 or later
50- * Graphviz -2.43.0 or later
51+ * Doxygen - 1.9.1
52+ * Graphviz -2.43.0
5153
5254for contributing
5355
54- * ClangFormat - 14.0.0 or later
56+ * ClangFormat - 14.0.0
5557
5658for generating gif
5759
58- * vhs - 0.2.0 or later
60+ * vhs - 0.2.0
5961
6062## Documentation
6163
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ SRCS = fetch.cpp main.cpp util.cpp
33OBJS = $(SRCS:.cpp=.o )
44
55CXX = @CXX@
6- CXXFLAGS = -std=c++2a -Wall -Wextra --pedantic-errors @CXXFLAGS@
6+ CXXFLAGS = -std=c++17 -Wall -Wextra --pedantic-errors @CXXFLAGS@
77LIBS = @LIBS@
88LDFLAGS = -pthread
99
Original file line number Diff line number Diff line change @@ -8,12 +8,23 @@ std::vector<std::runtime_error> Command::exceptions;
88std::mutex Command::mtx;
99string Context::PACKAGE_DELIM = " ; " s;
1010
11+ #include < pwd.h>
12+ #include < string.h>
13+ #include < unistd.h>
1114/* *
1215 * @returns gets the username
16+ * @throws runtime_error failed to get username
1317 */
1418string getuser ()
1519{
16- return getenv (" USER" );
20+ auto *p = getpwuid (getuid ());
21+ if (p == NULL )
22+ {
23+ throw runtime_error (
24+ " Could not get struct passwd: " s + strerror (errno));
25+ }
26+
27+ return p->pw_name ;
1728}
1829
1930/* *
@@ -634,3 +645,13 @@ void print(string color_name, string distro_name)
634645
635646 return ;
636647}
648+
649+ void test_getuser ()
650+ {
651+ expect (string (getenv (" USER" )), getuser (), " getuser" s);
652+ }
653+
654+ void test_fetch ()
655+ {
656+ test_getuser ();
657+ }
Original file line number Diff line number Diff line change 77#include " config.h"
88#include < algorithm>
99#include < cctype>
10+ #include < cerrno>
1011#include < filesystem>
1112#include < fstream>
1213#include < functional>
@@ -66,6 +67,8 @@ void printBattery(string path);
6667
6768void print (string color, string distro_name);
6869
70+ void test_fetch ();
71+
6972// util.cpp
7073
7174string getColor (string);
Original file line number Diff line number Diff line change 44#include " fetch.h"
55
66void DisplayInfo (bool show_battery);
7+ void test_suite ();
78
89/* *
910 * @returns
@@ -26,7 +27,7 @@ int main(int argc, char *argv[])
2627 // no-op
2728 break ;
2829 case Mode::EXEC_TEST:
29- test_util ();
30+ test_suite ();
3031 cout << Crayon{}.green ().text (" All unit tests passed." s) << endl;
3132 return 0 ;
3233 case Mode::SHOW_VERSION:
@@ -100,3 +101,9 @@ void DisplayInfo(bool show_battery)
100101
101102 cout << endl;
102103}
104+
105+ void test_suite ()
106+ {
107+ test_fetch ();
108+ test_util ();
109+ }
You can’t perform that action at this time.
0 commit comments