Carp/test/init_global.carp
Erik Svedäng 6f7aeaff73
feat: 'delete' interface (deciding whether a type is managed or not) (#1061)
* feat: 'delete' interface (deciding whether a type is managed or not)

* refactor: Move implements function to Interface module

* feat: Automatically implement 'delete' for types defined with `deftype`

* fix: Don't implement `delete` for Pointer

* refactor: Clarify `memberInfo` function

* fix: Also check if function types are managed

* fix: Implement 'delete' for String and StaticArray.

* fix: Manage String and Pattern. Tests run!

* feat: Add `managed?` primitive

* docs: Note about primitiveIsManaged

* test: Basic test cases for managed / nonmanaged external types

* test: Make sure `managed?` primitive works

* test: Inactivate sanitizer since we're creating leaks intentionally

* feat: Removed 'isExternalType' function

* refactor: Decide if struct member takes ref or not when printing

..based on blitable interface, and 'prn' implemntation

* refactor: Use 'blit' everywhere

* refactor: Implement `strTakesRefOrNot` in terms of `memberStrCallingConvention`

* refactor: Use `remove` over `filter not`
2020-12-20 21:21:14 +01:00

13 lines
462 B
Plaintext

;; This test is special because it requires it's own run.
;; It initializes a global with a something that needs to allocate memory and call functions,
;; then checks that the memory balance is correct after the init step.
(def g (copy (Array.unsafe-nth &[@"A" @"B" @"C"] 1)))
;; The one allocation left after 'carp_init_globals' should be 'g' itself:
(defn main []
(do
(Debug.log-memory-balance! true)
(assert (= 1l (Debug.memory-balance)))
0))