summary refs log tree commit diff stats
path: root/tests/dll/nimhcr_0_2.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dll/nimhcr_0_2.nim')
-rw-r--r--tests/dll/nimhcr_0_2.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/dll/nimhcr_0_2.nim b/tests/dll/nimhcr_0_2.nim
new file mode 100644
index 000000000..9ce228dc1
--- /dev/null
+++ b/tests/dll/nimhcr_0_2.nim
@@ -0,0 +1,18 @@
+
+import hotcodereloading
+
+import nimhcr_1 # new import!
+
+# global scope for this module was executed when loading the program
+# with a previous version which didn't contain this print statement
+echo "   0: I SHOULDN'T BE PRINTED!"
+
+var g_0 = 0 # changed value but won't take effect
+
+proc getInt*(): int = return g_0 + g_1 + f_1()
+
+beforeCodeReload:
+  echo "   0: before - improved!" # changed handlers!
+afterCodeReload:
+  echo "   0: after - improved!"
+  g_0 = 100 # we cannot change it in its initialization but we can in the 'after' handler!