GCC Code Coverage Report


Directory: src/
File: src/cmdline/jnamespaces-main.cpp
Date: 2025-10-15 09:43:47
Exec Total Coverage
Lines: 12 19 63.2%
Functions: 1 1 100.0%
Branches: 3 6 50.0%

Line Branch Exec Source
1 #include "jformat-identity.hpp"
2 #include <gyoji-misc/input-source-file.hpp>
3
4 using namespace Gyoji::context;
5 using namespace Gyoji::frontend;
6 using namespace Gyoji::frontend::tree;
7 using namespace Gyoji::frontend::namespaces;
8 using namespace Gyoji::cmdline;
9
10 48 int main(int argc, char **argv)
11 {
12
13
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
48 if (argc != 2) {
14 fprintf(stderr, "Invalid number of arguments %d\n", argc);
15 fprintf(stderr, "Usage: parser backend file\n");
16 exit(1);
17 }
18
19 48 int input = open(argv[1], O_RDONLY);
20
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
48 if (input == -1) {
21 fprintf(stderr, "Cannot open file %s\n", argv[1]);
22 exit(1);
23 }
24
25 48 CompilerContext context(argv[1]);
26
27 48 Gyoji::misc::InputSourceFile input_source(input);
28
29 Gyoji::owned<ParseResult> parse_result =
30 Parser::parse(
31 context,
32 input_source
33 48 );
34 48 close(input);
35
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 48 times.
48 if (parse_result->has_errors()) {
36 parse_result->get_errors().print();
37 return -1;
38 }
39
40 48 parse_result->get_ns2_context().dump();
41
42 48 return 0;
43 48 }
44