Browse Source

* Added test for double library entry with same name

git-svn-id: trunk@17776 -
pierre 14 years ago
parent
commit
c2b9bec684
4 changed files with 62 additions and 0 deletions
  1. 3 0
      .gitattributes
  2. 14 0
      tests/test/library/tlib1a.pp
  3. 14 0
      tests/test/library/tlib1a2.pp
  4. 31 0
      tests/test/library/tlib1b.pp

+ 3 - 0
.gitattributes

@@ -9634,6 +9634,9 @@ tests/test/cg/variants/tvarol96.pp svneol=native#text/plain
 tests/test/dumpclass.pp svneol=native#text/plain
 tests/test/dumpmethods.pp svneol=native#text/plain
 tests/test/lcpref.inc svneol=native#text/plain
+tests/test/library/tlib1a.pp svneol=native#text/plain
+tests/test/library/tlib1a2.pp svneol=native#text/plain
+tests/test/library/tlib1b.pp svneol=native#text/plain
 tests/test/opt/README.txt svneol=native#text/plain
 tests/test/opt/tarmshift.pp svneol=native#text/plain
 tests/test/opt/tcaseopt1.pp svneol=native#text/plain

+ 14 - 0
tests/test/library/tlib1a.pp

@@ -0,0 +1,14 @@
+{ %skiptarget=go32v2 }
+{ %norun }
+{$goto on}
+library tlib1a;
+
+  procedure p(var a : dword);
+    begin
+      a:=1;
+    end;
+
+  exports p;
+
+begin
+end.

+ 14 - 0
tests/test/library/tlib1a2.pp

@@ -0,0 +1,14 @@
+{ %skiptarget=go32v2 }
+{ %norun }
+{$goto on}
+library tlib1a2;
+
+  procedure p(var a : dword);
+    begin
+      a:=2;
+    end;
+
+  exports p;
+
+begin
+end.

+ 31 - 0
tests/test/library/tlib1b.pp

@@ -0,0 +1,31 @@
+{ %skiptarget=go32v2 }
+{ %needlibrary }
+{$goto on}
+
+
+{ Checks that the two functions with the same exported name 'p'
+  are each loaded correctly. }
+uses
+  {$ifdef unix}dl,{$endif unix}sysutils;
+
+{$ifdef darwin}
+{$linklib tlib1a}
+{$linklib tlib1a2}
+{$endif darwin}
+
+procedure p(var a : dword);external 'tlib1a' name 'p';
+procedure p2(var a : dword);external 'tlib1a2' name 'p';
+
+var
+  a : dword;
+begin
+  a:=0;
+  p(a);
+  if a <> 1 then
+    halt(1);
+  p2(a);
+  if a <> 2 then
+    halt(2);
+
+  writeln('ok');
+end.