summaryrefslogtreecommitdiffstats
path: root/test cases/csharp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/csharp
parentInitial commit. (diff)
downloadmeson-upstream.tar.xz
meson-upstream.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/csharp')
-rw-r--r--test cases/csharp/1 basic/meson.build4
-rw-r--r--test cases/csharp/1 basic/prog.cs8
-rw-r--r--test cases/csharp/1 basic/test.json6
-rw-r--r--test cases/csharp/1 basic/text.cs7
-rw-r--r--test cases/csharp/2 library/helper.cs7
-rw-r--r--test cases/csharp/2 library/meson.build15
-rw-r--r--test cases/csharp/2 library/prog.cs8
-rw-r--r--test cases/csharp/2 library/test.json9
-rw-r--r--test cases/csharp/3 resource/TestRes.resx31
-rw-r--r--test cases/csharp/3 resource/meson.build6
-rw-r--r--test cases/csharp/3 resource/resprog.cs13
-rw-r--r--test cases/csharp/4 external dep/hello.txt1
-rw-r--r--test cases/csharp/4 external dep/meson.build9
-rw-r--r--test cases/csharp/4 external dep/prog.cs8
-rw-r--r--test cases/csharp/4 external dep/test.json5
15 files changed, 137 insertions, 0 deletions
diff --git a/test cases/csharp/1 basic/meson.build b/test cases/csharp/1 basic/meson.build
new file mode 100644
index 0000000..09e46c2
--- /dev/null
+++ b/test cases/csharp/1 basic/meson.build
@@ -0,0 +1,4 @@
+project('simple c#', 'cs')
+
+e = executable('prog', 'prog.cs', 'text.cs', install : true)
+test('basic', e)
diff --git a/test cases/csharp/1 basic/prog.cs b/test cases/csharp/1 basic/prog.cs
new file mode 100644
index 0000000..6ee47b0
--- /dev/null
+++ b/test cases/csharp/1 basic/prog.cs
@@ -0,0 +1,8 @@
+using System;
+
+public class Prog {
+ static public void Main () {
+ TextGetter tg = new TextGetter();
+ Console.WriteLine(tg.getText());
+ }
+}
diff --git a/test cases/csharp/1 basic/test.json b/test cases/csharp/1 basic/test.json
new file mode 100644
index 0000000..650a6e2
--- /dev/null
+++ b/test cases/csharp/1 basic/test.json
@@ -0,0 +1,6 @@
+{
+ "installed": [
+ {"type": "file", "file": "usr/bin/prog.exe"},
+ {"type": "pdb", "file": "usr/bin/prog"}
+ ]
+}
diff --git a/test cases/csharp/1 basic/text.cs b/test cases/csharp/1 basic/text.cs
new file mode 100644
index 0000000..c83c424
--- /dev/null
+++ b/test cases/csharp/1 basic/text.cs
@@ -0,0 +1,7 @@
+using System;
+
+public class TextGetter {
+ public String getText() {
+ return "C# is working.";
+ }
+}
diff --git a/test cases/csharp/2 library/helper.cs b/test cases/csharp/2 library/helper.cs
new file mode 100644
index 0000000..266e379
--- /dev/null
+++ b/test cases/csharp/2 library/helper.cs
@@ -0,0 +1,7 @@
+using System;
+
+public class Helper {
+ public void print() {
+ Console.WriteLine("Library class called.");
+ }
+}
diff --git a/test cases/csharp/2 library/meson.build b/test cases/csharp/2 library/meson.build
new file mode 100644
index 0000000..6b246a4
--- /dev/null
+++ b/test cases/csharp/2 library/meson.build
@@ -0,0 +1,15 @@
+project('C# library', 'cs')
+
+python3 = import('python3').find_python()
+generated_sources = custom_target('gen_sources',
+ input: 'helper.cs',
+ output: 'helper.cs',
+ command: [python3, '-c',
+ 'import shutil, sys; shutil.copyfile(sys.argv[1], sys.argv[2])',
+ '@INPUT@', '@OUTPUT@']
+)
+
+l = shared_library('helper', generated_sources, install : true)
+
+e = executable('prog', 'prog.cs', link_with : l, install : true)
+test('libtest', e)
diff --git a/test cases/csharp/2 library/prog.cs b/test cases/csharp/2 library/prog.cs
new file mode 100644
index 0000000..8bf6a31
--- /dev/null
+++ b/test cases/csharp/2 library/prog.cs
@@ -0,0 +1,8 @@
+using System;
+
+public class Prog {
+ static public void Main () {
+ Helper h = new Helper();
+ h.print();
+ }
+}
diff --git a/test cases/csharp/2 library/test.json b/test cases/csharp/2 library/test.json
new file mode 100644
index 0000000..0523f45
--- /dev/null
+++ b/test cases/csharp/2 library/test.json
@@ -0,0 +1,9 @@
+{
+ "installed": [
+ {"type": "file", "file": "usr/bin/prog.exe"},
+ {"type": "pdb", "file": "usr/bin/prog"},
+ {"type": "file", "platform": "msvc", "file": "usr/bin/helper.dll"},
+ {"type": "pdb", "file": "usr/bin/helper"},
+ {"type": "file", "platform": "gcc", "file": "usr/lib/helper.dll"}
+ ]
+}
diff --git a/test cases/csharp/3 resource/TestRes.resx b/test cases/csharp/3 resource/TestRes.resx
new file mode 100644
index 0000000..c85f85c
--- /dev/null
+++ b/test cases/csharp/3 resource/TestRes.resx
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+<resheader name="resmimetype"><value>text/microsoft-resx</value></resheader><resheader name="version"><value>1.3</value></resheader><resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader><resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader><data name="message"><value>Hello from resources!</value></data>
+ </root> \ No newline at end of file
diff --git a/test cases/csharp/3 resource/meson.build b/test cases/csharp/3 resource/meson.build
new file mode 100644
index 0000000..25b273d
--- /dev/null
+++ b/test cases/csharp/3 resource/meson.build
@@ -0,0 +1,6 @@
+project('C# resource', 'cs')
+
+e = executable('resprog', 'resprog.cs',
+resources : 'TestRes.resx')
+
+test('restest', e)
diff --git a/test cases/csharp/3 resource/resprog.cs b/test cases/csharp/3 resource/resprog.cs
new file mode 100644
index 0000000..177201c
--- /dev/null
+++ b/test cases/csharp/3 resource/resprog.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Resources;
+
+public class Prog {
+
+ static public void Main () {
+ ResourceManager res = new ResourceManager(typeof(TestRes));
+ Console.WriteLine(res.GetString("message"));
+ }
+
+ internal class TestRes {
+ }
+}
diff --git a/test cases/csharp/4 external dep/hello.txt b/test cases/csharp/4 external dep/hello.txt
new file mode 100644
index 0000000..980a0d5
--- /dev/null
+++ b/test cases/csharp/4 external dep/hello.txt
@@ -0,0 +1 @@
+Hello World!
diff --git a/test cases/csharp/4 external dep/meson.build b/test cases/csharp/4 external dep/meson.build
new file mode 100644
index 0000000..019d618
--- /dev/null
+++ b/test cases/csharp/4 external dep/meson.build
@@ -0,0 +1,9 @@
+project('C# external library', 'cs')
+glib_sharp_2 = dependency('glib-sharp-2.0', required : false)
+
+if not glib_sharp_2.found()
+ error('MESON_SKIP_TEST glib# not found.')
+endif
+
+e = executable('prog', 'prog.cs', dependencies: glib_sharp_2, install : true)
+test('libtest', e, args: [join_paths(meson.current_source_dir(), 'hello.txt')])
diff --git a/test cases/csharp/4 external dep/prog.cs b/test cases/csharp/4 external dep/prog.cs
new file mode 100644
index 0000000..9393fef
--- /dev/null
+++ b/test cases/csharp/4 external dep/prog.cs
@@ -0,0 +1,8 @@
+using System;
+using GLib;
+
+public class Prog {
+ static public void Main (string[] args) {
+ Console.WriteLine(GLib.FileUtils.GetFileContents(args[0]));
+ }
+}
diff --git a/test cases/csharp/4 external dep/test.json b/test cases/csharp/4 external dep/test.json
new file mode 100644
index 0000000..a94303f
--- /dev/null
+++ b/test cases/csharp/4 external dep/test.json
@@ -0,0 +1,5 @@
+{
+ "installed": [
+ {"type": "file", "file": "usr/bin/prog.exe"}
+ ]
+}