feat(pty): rename get_pts() -> get_pts_name()

This commit is contained in:
Leroy Hopson 2024-03-03 17:49:49 +13:00
parent c6609ebae5
commit b78bdf3136
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
4 changed files with 12 additions and 11 deletions

View file

@ -62,7 +62,7 @@ void PTY::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_using_threads"), &PTY::is_using_threads);
ClassDB::add_property("PTY", PropertyInfo(Variant::BOOL, "use_threads"), "set_use_threads", "is_using_threads");
ClassDB::bind_method(D_METHOD("get_pts"), &PTY::get_pts);
ClassDB::bind_method(D_METHOD("get_pts_name"), &PTY::get_pts_name);
ClassDB::bind_method(D_METHOD("fork", "file", "args", "cwd", "cols", "rows"), &PTY::fork, DEFVAL(""), DEFVAL(PackedStringArray()), DEFVAL("."), DEFVAL(80), DEFVAL(24));
ClassDB::bind_method(D_METHOD("open", "cols", "rows"), &PTY::open, DEFVAL(80), DEFVAL(24));
@ -126,8 +126,8 @@ bool PTY::is_using_threads() const {
return use_threads;
}
String PTY::get_pts() const {
return pts;
String PTY::get_pts_name() const {
return pts_name;
}
Error PTY::fork(const String &file, const PackedStringArray &args, const String &cwd, const int cols, const int rows) {
@ -145,8 +145,8 @@ Error PTY::fork(const String &file, const PackedStringArray &args, const String
fd = result["fd"];
pid = result["pid"];
pts = result["pty"];
pts_name = result["pty"];
status = STATUS_OPEN;
#if defined(__linux__) || defined(__APPLE__)
@ -181,7 +181,7 @@ Error PTY::open(const int cols, const int rows) {
Error err = static_cast<Error>((int)result["error"]);
ERR_FAIL_COND_V(err != OK, err);
pts = result["pty"];
pts_name = result["pty"];
return OK;
}

View file

@ -58,7 +58,7 @@ namespace godot
void set_use_threads(bool p_use);
bool is_using_threads() const;
String get_pts() const;
String get_pts_name() const;
Error fork(const String &file = "", const PackedStringArray &args = PackedStringArray(), const String &cwd = ".", const int cols = 80, const int rows = 24);
void kill(const int signum = Signal::SIGNAL_SIGHUP);
@ -82,7 +82,7 @@ namespace godot
Dictionary env = Dictionary();
bool use_os_env = true;
String pts = "";
String pts_name = "";
String _get_fork_file(const String &file) const;
Dictionary _get_fork_env() const;

View file

@ -43,7 +43,7 @@ func test_open_pty_has_correct_name():
var new_pts = helper.get_pts()
for pt in original_pts:
new_pts.erase(pt)
assert_eq(subject.get_pts(), new_pts[0])
assert_eq(subject.get_pts_name(), new_pts[0])
func xtest_open_pty_has_correct_win_size():

View file

@ -11,8 +11,6 @@ func get_described_class():
class TestInterface:
extends PTYTest
## API V2.
# Properties.
# TODO: Implement cols property.
@ -46,6 +44,9 @@ class TestInterface:
func test_has_method_open():
assert_has_method_with_return_type("open", TYPE_INT)
func test_has_method_get_pts_name():
assert_has_method_with_return_type("get_pts_name", TYPE_STRING)
func test_has_method_resize():
assert_has_method_with_return_type("resize", TYPE_NIL)