Skip to content

Improve/update tests #590

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

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions regression-tests/mixed-fixed-type-aliases.cpp2
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <typeinfo>
#include <filesystem>
#include <iostream>
#include <typeinfo>

namespace my {
using u16 = float;
Expand All @@ -20,5 +21,5 @@ main: (args) -> int = {
test(z);

for args do (arg)
std::cout << arg << "\n";
std::cout << std::filesystem::path(arg).filename() << "\n";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a bit of a hack, but avoids issues like different relative paths or absolute path used for execution.

}
2 changes: 1 addition & 1 deletion regression-tests/pure2-stdio-with-raii.cpp2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// "A better C than C" ... ?
//
main: () -> int = {
s: std::string = "Freddy";
s: std::string = "Fred";
myfile := cpp2::fopen("xyzzy", "w");
_ = myfile.fprintf( "Hello %s with UFCS!", s.c_str() );
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
true
false
./test.exe
"test.exe"
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
args.argc is 1, and args.argv[0] is ./test.exe
args.argc is 1
args.argv[0] is ./test.exe
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ myclass: explicit from string
myclass: default
data: 504, more: 3.141590
myclass: from int and string
data: 77, more: hair plugh
data: 77, more: hair1 plugh
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is currently causing a failure on macOS.

x's state before assignments: data: 1, more: 504
myclass: implicit from int
data: 84, more: 504
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
true
false
./test.exe
"test.exe"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
true
false
./test.exe
"test.exe"
2 changes: 1 addition & 1 deletion regression-tests/test-results/gcc-13/xyzzy
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Hello Freddy with UFCS!
Hello Fred with UFCS!
13 changes: 7 additions & 6 deletions regression-tests/test-results/mixed-fixed-type-aliases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,26 @@

//=== Cpp2 type definitions and function declarations ===========================

#include <typeinfo>
#include <filesystem>
#include <iostream>
#include <typeinfo>

namespace my {
using u16 = float;
}

#line 8 "mixed-fixed-type-aliases.cpp2"
#line 9 "mixed-fixed-type-aliases.cpp2"
auto test(auto const& x) -> void;


#line 15 "mixed-fixed-type-aliases.cpp2"
#line 16 "mixed-fixed-type-aliases.cpp2"
[[nodiscard]] auto main(int const argc_, char** argv_) -> int;


//=== Cpp2 function definitions =================================================


#line 8 "mixed-fixed-type-aliases.cpp2"
#line 9 "mixed-fixed-type-aliases.cpp2"
auto test(auto const& x) -> void{
std::cout
<< std::boolalpha
Expand All @@ -37,14 +38,14 @@ auto test(auto const& x) -> void{

[[nodiscard]] auto main(int const argc_, char** argv_) -> int{
auto args = cpp2::make_args(argc_, argv_);
#line 16 "mixed-fixed-type-aliases.cpp2"
#line 17 "mixed-fixed-type-aliases.cpp2"
my::u16 y {42};
test(std::move(y));

cpp2::u16 z {42};
test(std::move(z));

for ( auto const& arg : args )
std::cout << arg << "\n";
std::cout << CPP2_UFCS_0(filename, std::filesystem::path(arg)) << "\n";
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
true
false
test.exe
"test.exe"
2 changes: 1 addition & 1 deletion regression-tests/test-results/pure2-stdio-with-raii.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#line 4 "pure2-stdio-with-raii.cpp2"
[[nodiscard]] auto main() -> int{
std::string s {"Freddy"};
std::string s {"Fred"};
auto myfile {cpp2::fopen("xyzzy", "w")};
static_cast<void>(CPP2_UFCS(fprintf, std::move(myfile), "Hello %s with UFCS!", CPP2_UFCS_0(c_str, std::move(s))));
}
Expand Down