diff options
Diffstat (limited to 'meson/test cases/common/234 get_file_contents')
-rw-r--r-- | meson/test cases/common/234 get_file_contents/.gitattributes | 1 | ||||
-rw-r--r-- | meson/test cases/common/234 get_file_contents/VERSION | 1 | ||||
-rw-r--r-- | meson/test cases/common/234 get_file_contents/meson.build | 21 | ||||
-rw-r--r-- | meson/test cases/common/234 get_file_contents/other/meson.build | 3 | ||||
-rw-r--r-- | meson/test cases/common/234 get_file_contents/utf-16-text | bin | 0 -> 150 bytes |
5 files changed, 26 insertions, 0 deletions
diff --git a/meson/test cases/common/234 get_file_contents/.gitattributes b/meson/test cases/common/234 get_file_contents/.gitattributes new file mode 100644 index 000000000..abec47db4 --- /dev/null +++ b/meson/test cases/common/234 get_file_contents/.gitattributes @@ -0,0 +1 @@ +utf-16-text binary diff --git a/meson/test cases/common/234 get_file_contents/VERSION b/meson/test cases/common/234 get_file_contents/VERSION new file mode 100644 index 000000000..26aaba0e8 --- /dev/null +++ b/meson/test cases/common/234 get_file_contents/VERSION @@ -0,0 +1 @@ +1.2.0 diff --git a/meson/test cases/common/234 get_file_contents/meson.build b/meson/test cases/common/234 get_file_contents/meson.build new file mode 100644 index 000000000..a8c68d63f --- /dev/null +++ b/meson/test cases/common/234 get_file_contents/meson.build @@ -0,0 +1,21 @@ +project( + 'meson-fs-read-file', + [], + version: files('VERSION') +) +fs = import('fs') + +assert(fs.read('VERSION').strip() == meson.project_version(), 'file misread') + +expected = ( + '∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β)' +) +assert( + fs.read('utf-16-text', encoding: 'utf-16').strip() == expected, + 'file was not decoded correctly' +) + +# Make sure we handle `files()` objects properly, too +version_file = files('VERSION') + +subdir('other') diff --git a/meson/test cases/common/234 get_file_contents/other/meson.build b/meson/test cases/common/234 get_file_contents/other/meson.build new file mode 100644 index 000000000..9a7e4be56 --- /dev/null +++ b/meson/test cases/common/234 get_file_contents/other/meson.build @@ -0,0 +1,3 @@ +fs = import('fs') +assert(fs.read(version_file).strip() == '1.2.0') +assert(fs.read('../VERSION').strip() == '1.2.0') diff --git a/meson/test cases/common/234 get_file_contents/utf-16-text b/meson/test cases/common/234 get_file_contents/utf-16-text Binary files differnew file mode 100644 index 000000000..ed1fefe83 --- /dev/null +++ b/meson/test cases/common/234 get_file_contents/utf-16-text |