Skip to content

Commit 545cd48

Browse files
ike709ike709wixoaGit
authored
Misc builtin tests (#2388)
Co-authored-by: ike709 <[email protected]> Co-authored-by: wixoa <[email protected]>
1 parent cef5232 commit 545cd48

File tree

11 files changed

+41
-2
lines changed

11 files changed

+41
-2
lines changed

Content.Tests/DMProject/Tests/Builtins/astype.dm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,25 @@
77
var/datum/foo/bar/B = astype(D)
88
return isnull(B)
99

10+
/proc/test_null2()
11+
var/datum/D = new
12+
var/datum/foo/bar/B = astype(D, /datum/foo/bar)
13+
return isnull(B)
14+
1015
/proc/test_type()
1116
var/datum/foo/bar/B = new
1217
var/datum/D = astype(B)
1318
var/datum/foo/F = astype(D)
1419
return F.type
1520

21+
/proc/test_type2()
22+
var/datum/foo/bar/B = new
23+
var/datum/D = astype(B, /datum)
24+
var/datum/foo/F = astype(D, /datum/foo)
25+
return F.type
26+
1627
/proc/RunTest()
1728
ASSERT(test_null())
29+
ASSERT(test_null2())
1830
ASSERT(test_type() == /datum/foo/bar)
31+
ASSERT(test_type2() == /datum/foo/bar)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/datum/foo
2+
/proc/RunTest()
3+
var/datum/foo/F = locate()
4+
ASSERT(isnull(F))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// COMPILE ERROR OD0404
2+
3+
/proc/RunTest()
4+
var/datum/foo/F = locate()
File renamed without changes.
File renamed without changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// COMPILE ERROR OD0013
2+
/proc/RunTest()
3+
rgb(1,2)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// COMPILE ERROR OD0013
2+
/proc/RunTest()
3+
rgb(1,2,3,4,5,6)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// COMPILE ERROR OD2208
2+
#pragma FallbackBuiltinArgument error
3+
/datum/foo/var/bar = rgb(1,2,null)
4+
/proc/RunTest()
5+
return
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// COMPILE ERROR OD0013
2+
/proc/RunTest()
3+
var/a = pick(prob(50);1)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/proc/RunTest()
2+
var/foo = 1
3+
ASSERT(issaved(foo) == FALSE)

0 commit comments

Comments
 (0)