-
Notifications
You must be signed in to change notification settings - Fork 125
Clean and tag unit tests for use with BYOND unit test framework #2426
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
e4758d6
c57c27d
412108b
070ac66
72cf5ed
494c578
7bfe2b1
21a22fe
d58b337
1e86092
7cfe9b5
f58cfe1
bde6714
3c1170e
e7dff89
d95dafb
2d7dcc0
bcead00
1dba0f9
208076f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
|
|
||
| //# issue 697 | ||
|
|
||
| // TODO: A lot of macros seem to also be in global.vars in BYOND but this isn't implemented in OD yet | ||
|
|
||
| /proc/RunTest() | ||
| ASSERT(global.vars["TRUE"] == 1) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| // NOBYOND | ||
| #pragma SoftReservedKeyword warning | ||
|
|
||
| //global src def | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| /proc/RunTest(datum/arg = new()) | ||
| /proc/RunTest(datum/arg = new()) | ||
| ASSERT(istype(arg, /datum)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| //COMPILE ERROR OD2000 | ||
| // NOBYOND | ||
| var/src = 321 | ||
|
|
||
| /proc/RunTest() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| //COMPILE ERROR OD2000 | ||
| // NOBYOND | ||
| /proc/test(args) | ||
| return 1 | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| //COMPILE ERROR OD2000 | ||
| // NOBYOND | ||
| /proc/RunTest() | ||
| var/usr = 123 | ||
| world.log << "fail" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // RUNTIME ERROR | ||
| // RUNTIME ERROR | ||
|
|
||
| /proc/RunTest() | ||
| ASSERT(FALSE) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| ASSERT(TRUE) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| var/out1 = clamp(10, 1, 5) | ||
| ASSERT(out1 == 5) | ||
| var/out2 = clamp(-10, 1, 5) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| // COMPILE ERROR OD0100 | ||
|
|
||
| // NOBYOND | ||
| /proc/RunTest() | ||
| var/foo = log("e") | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| // COMPILE ERROR OD0100 | ||
|
|
||
| // NOBYOND | ||
| /proc/RunTest() | ||
| var/foo = log(2,"e") | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| | ||
|
|
||
| /datum/proc/foo() | ||
|
|
||
| /proc/RunTest() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| ASSERT(md5("md5_test") == "c74318b61a3024520c466f828c043c79") | ||
| ASSERT(md5(file('turf.dmi')) == "0ce21a42eed3205f5e22eabac6f02eaa") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| // Single arg returns that arg | ||
| ASSERT(max(1) == 1) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| ASSERT(sha1("ABCDEF") == "970093678b182127f60bb51b8af2c94d539eca3a") | ||
| ASSERT(sha1("abcdef") == "1f8ac10f23c5b5bc1167bda84b833e5c057a77d2") | ||
| ASSERT(sha1(file('turf.dmi')) == "513e55e301c44636c3e9cf6162cf896107c1d984") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| // COMPILE ERROR OD0100 | ||
| // NOBYOND | ||
| /proc/RunTest() | ||
| var/foo | ||
| initial(issaved(foo)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| ASSERT(trimtext(" test") == "test") | ||
| ASSERT(trimtext("test ") == "test") | ||
| ASSERT(trimtext(" test ") == "test") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
|
|
||
| // NOBYOND | ||
| /proc/RunTest() | ||
| ASSERT(isnum(world.opendream_topic_port)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/async_return() | ||
| /proc/async_return() | ||
| . = 420 | ||
| sleep(0) | ||
| return 1337 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /datum/proc/call_target() | ||
| /datum/proc/call_target() | ||
| return 13 | ||
|
|
||
| /proc/RunTest() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // RUNTIME ERROR, RETURN TRUE | ||
| // RUNTIME ERROR, RETURN TRUE | ||
|
|
||
| /proc/RunTest() | ||
| . = TRUE | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| // NOBYOND | ||
| #pragma PointlessParentCall error | ||
|
|
||
| // don't emit the pragma if lateral overrides exist | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| // RUNTIME ERROR | ||
| // RUNTIME ERROR | ||
| // NOBYOND - compile error in byond | ||
|
|
||
| /proc/RunTest() | ||
| world:nonexistent_proc() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // RUNTIME ERROR, NO RETURN | ||
| // RUNTIME ERROR, NO RETURN | ||
|
|
||
| /proc/RunTest() | ||
| . = TRUE | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /datum/parent | ||
| /datum/parent | ||
| proc/f(a) | ||
| return a | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/sync_test() | ||
| /proc/sync_test() | ||
| return 1992 | ||
|
|
||
| /proc/RunTest() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| var/a = 137 | ||
| switch(a) | ||
| if(20) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #include "Shared/Recursive.dm" | ||
| #include "Shared/Recursive.dm" | ||
|
|
||
| /proc/RunTest() | ||
| var/datum/recursive/R = new() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // RUNTIME ERROR | ||
| // RUNTIME ERROR | ||
| #include "Shared/Recursive.dm" | ||
|
|
||
| /proc/RunTest() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // IGNORE | ||
| // IGNORE | ||
| // This test case is currently broken | ||
| #include "Shared/Recursive.dm" | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // RUNTIME ERROR | ||
| // RUNTIME ERROR | ||
| #include "Shared/Recursive.dm" | ||
|
|
||
| /proc/RunTest() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #include "Shared/Recursive.dm" | ||
| #include "Shared/Recursive.dm" | ||
|
|
||
| /proc/RunTest() | ||
| var/datum/recursive/R = null | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // IGNORE | ||
| // IGNORE | ||
|
|
||
| /datum/recursive | ||
| var/datum/recursive/inner | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /datum/A/var/TestSrcVar = "A" | ||
| /datum/A/var/TestSrcVar = "A" | ||
| /datum/A/proc/TestSrcProc() | ||
| return "A" | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,8 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| var/list/L1 = list("A" = 1) | ||
| var/list/L2 = list("B" = 2) | ||
|
|
||
| ASSERT( (L1 + L2)["B"] == 2 ) | ||
|
|
||
| L1 += L2 | ||
| ASSERT(L1["B"] == 2) | ||
| ASSERT(L1.len == 2) | ||
|
|
||
| // Lists are fun | ||
| L1 += L2 | ||
| ASSERT(L1[3] == "B") | ||
| ASSERT(L1.len == 3) | ||
|
Comment on lines
-9
to
-14
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This too |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| var/list/L = list("A") | ||
| L |= list("B" = 1) | ||
| ASSERT(L ~= list("A", "B" = 1)) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| var/a = "World" | ||
| var/b = "Hello" | ||
| var/c = "Goodbye" | ||
|
|
@@ -13,4 +13,3 @@ | |
| ASSERT(L[b] == 2) | ||
| ASSERT(L["c"] == 3) | ||
| ASSERT(L[c] == null) | ||
| ASSERT(L.len == 3) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this removed? Works in BYOND. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| var/list/A = list(1,2,3) | ||
| ASSERT(A.len == 3) | ||
| A.Cut() | ||
|
|
@@ -9,15 +9,3 @@ | |
| ASSERT(A ~= list("b" = 20)) | ||
| ASSERT(A["a"] == null) | ||
| ASSERT(A["b"] == 20) | ||
|
|
||
| A = list(a = 10) | ||
| A += A | ||
| A.Cut(1, 2) | ||
| ASSERT(A ~= list("a")) | ||
| ASSERT(A["a"] == null) | ||
|
|
||
| A = list(a = 10) | ||
| A += A | ||
| A.Cut(2, 0) | ||
| ASSERT(A ~= list("a")) | ||
| ASSERT(A["a"] == null) | ||
|
Comment on lines
-12
to
-23
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also works in BYOND. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| var/list/L = list() | ||
| L.Cut() | ||
| // Incase of weird proc issues | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| var/list/L = list(1, 2, 3, 4, 5) | ||
|
|
||
| ASSERT(L.Join(";") == "1;2;3;4;5") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| var/list/L = list(1, 2, 3) | ||
| L[2] *= 15 | ||
| L[3] *= 0 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| // RUNTIME ERROR | ||
| // NOBYOND | ||
| #pragma ListNegativeSizeException error | ||
|
|
||
| /proc/DecrementList() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| var/list/L = list(1, 2, 3) | ||
| ASSERT(!(4 in L)) | ||
| ASSERT(3 in L) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| var/counter = 0 | ||
| for(var/i in 1 to 3) | ||
| counter++ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| var/i = 0 | ||
| var/j = 0 | ||
| var/list/L1 = null | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /datum/a | ||
| /datum/a | ||
| /datum/b | ||
|
|
||
| /proc/RunTest() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /proc/RunTest() | ||
| /proc/RunTest() | ||
| var/i = 1 | ||
|
|
||
| i++ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.