-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add eq handling to java type metatables add more tests and slight test re-org
- Loading branch information
Showing
8 changed files
with
90 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
-- _ ____ _ _ _______ _ | ||
-- | | | _ \ (_) | | |__ __| | | | ||
-- | | __ ___ ____ _| |_) |_ __ _ __| | __ _ ___ | | ___ ___| |_ ___ | ||
-- _ | |/ _` \ \ / / _` | _ <| '__| |/ _` |/ _` |/ _ \ | |/ _ \/ __| __/ __| | ||
-- | |__| | (_| |\ V / (_| | |_) | | | | (_| | (_| | __/ | | __/\__ \ |_\__ \ | ||
-- \____/ \__,_| \_/ \__,_|____/|_| |_|\__,_|\__, |\___| |_|\___||___/\__|___/ | ||
-- __/ | | ||
-- |___/ | ||
|
||
print("*****************************") | ||
print("Running java_bridge tests....") | ||
|
||
function test_method_id_comparison() | ||
io.write("Running test_method_id_comparison().....") | ||
|
||
local m1 = lj_get_method_id("java/lang/String", "toUpperCase", "", "Ljava/lang/String;") | ||
local m2 = lj_get_method_id("java/lang/String", "toUpperCase", "", "Ljava/lang/String;") | ||
assert(m1 and m2) | ||
-- should have different addresses in the string representation | ||
assert(string.format("%s", m1) ~= string.format("%s", m2)) | ||
-- should compare as equal | ||
assert(m1 == m2) | ||
|
||
local m3 = lj_get_method_id("java/lang/String", "toString", "", "Ljava/lang/String;") | ||
local m4 = lj_get_method_id("java/lang/Class", "toString", "", "Ljava/lang/String;") | ||
assert(m3 and m4) | ||
-- different classes means different methods | ||
assert(m3 ~= m4) | ||
assert(m1 ~= m3) | ||
|
||
local m5 = lj_get_method_id("blabbity bla", "asd", "", "V") | ||
assert(m5 == nil) | ||
|
||
print("ok") | ||
end | ||
|
||
-- not comprehensive | ||
function test_basic_field_access() | ||
io.write("Running test_basic_field_access().....") | ||
|
||
local t = lj_get_current_thread() | ||
|
||
-- static field | ||
assert(t.MIN_PRIORITY == 1) | ||
|
||
-- private instance field | ||
assert(lj_toString(t) == lj_toString(t.me)) | ||
|
||
print("ok") | ||
end | ||
|
||
test_method_id_comparison() | ||
test_basic_field_access() |
File renamed without changes.