fix: noconfirm auto-selects first AUR match
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
[meson.build]
|
||||
trim_trailing_whitespace = false
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char c = CHAR;
|
||||
assert(argc == 2);
|
||||
if (c != argv[1][0])
|
||||
fprintf(stderr, "Expected %x, got %x\n", (unsigned int) c, (unsigned int) argv[1][0]);
|
||||
assert(c == argv[1][0]);
|
||||
return 0;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const char *s = CHAR;
|
||||
assert(argc == 2);
|
||||
assert(strlen(s) == 1);
|
||||
if (s[0] != argv[1][0])
|
||||
fprintf(stderr, "Expected %x, got %x\n", (unsigned int) s[0], (unsigned int) argv[1][0]);
|
||||
assert(s[0] == argv[1][0]);
|
||||
return 0;
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define Q(x) #x
|
||||
#define QUOTE(x) Q(x)
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const char *s = QUOTE(CHAR);
|
||||
assert(argc == 2);
|
||||
assert(strlen(s) == 1);
|
||||
if (s[0] != argv[1][0])
|
||||
fprintf(stderr, "Expected %x, got %x\n", (unsigned int) s[0], (unsigned int) argv[1][0]);
|
||||
assert(s[0] == argv[1][0]);
|
||||
// There is no way to convert a macro argument into a character constant.
|
||||
// Otherwise we'd test that as well
|
||||
return 0;
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
|
||||
expected = {
|
||||
'newline': '\n',
|
||||
'dollar': '$',
|
||||
'colon': ':',
|
||||
'space': ' ',
|
||||
'multi1': ' ::$$ ::$$',
|
||||
'multi2': ' ::$$\n\n \n\n::$$',
|
||||
}
|
||||
|
||||
output = None
|
||||
|
||||
for arg in sys.argv[1:]:
|
||||
try:
|
||||
name, value = arg.split('=', 1)
|
||||
except ValueError:
|
||||
output = arg
|
||||
continue
|
||||
|
||||
if expected[name] != value:
|
||||
raise RuntimeError('{!r} is {!r} but should be {!r}'.format(name, value, expected[name]))
|
||||
|
||||
if output is not None:
|
||||
with open(output, 'w') as f:
|
||||
f.write('Success!')
|
||||
@@ -0,0 +1,75 @@
|
||||
project('ninja special characters' ,'c')
|
||||
|
||||
python = import('python3').find_python()
|
||||
|
||||
# Without newlines, this should appear directly in build.ninja.
|
||||
gen = custom_target('gen',
|
||||
command : [
|
||||
python,
|
||||
files('check_quoting.py'),
|
||||
'dollar=$',
|
||||
'colon=:',
|
||||
'space= ',
|
||||
'''multi1= ::$$ ::$$''',
|
||||
'@OUTPUT@'],
|
||||
output : 'result',
|
||||
install : true,
|
||||
install_dir : get_option('datadir'))
|
||||
|
||||
# With newlines, this should go through the exe wrapper.
|
||||
gen2 = custom_target('gen2',
|
||||
command : [
|
||||
python,
|
||||
files('check_quoting.py'),
|
||||
'''newline=
|
||||
''',
|
||||
'dollar=$',
|
||||
'colon=:',
|
||||
'space= ',
|
||||
'''multi2= ::$$
|
||||
|
||||
|
||||
|
||||
::$$''',
|
||||
'@OUTPUT@'],
|
||||
output : 'result2',
|
||||
install : true,
|
||||
install_dir : get_option('datadir'))
|
||||
|
||||
# Test that we can pass these special characters in compiler arguments
|
||||
#
|
||||
# (this part of the test is crafted so we don't try to use these special
|
||||
# characters in filenames or target names)
|
||||
#
|
||||
# TODO: similar tests needed for languages other than C
|
||||
# TODO: add similar test for quote, doublequote, and hash, carefully
|
||||
# Re hash, see
|
||||
# https://docs.microsoft.com/en-us/cpp/build/reference/d-preprocessor-definitions
|
||||
|
||||
special = [
|
||||
['amp', '&'],
|
||||
['at', '@'],
|
||||
['backslash', '\\'],
|
||||
['dollar', '$'],
|
||||
['gt', '>'],
|
||||
['lt', '<'],
|
||||
['slash', '/'],
|
||||
]
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
foreach s : special
|
||||
args = '-DCHAR="@0@"'.format(s[1])
|
||||
e = executable('arg-string-' + s[0], 'arg-string-test.c', c_args: args)
|
||||
test('arg-string-' + s[0], e, args: s[1])
|
||||
|
||||
args = '-DCHAR=@0@'.format(s[1])
|
||||
e = executable('arg-unquoted-' + s[0], 'arg-unquoted-test.c', c_args: args)
|
||||
test('arg-unquoted-' + s[0], e, args: s[1])
|
||||
endforeach
|
||||
|
||||
foreach s : special
|
||||
args = '-DCHAR=\'@0@\''.format(s[1])
|
||||
e = executable('arg-char-' + s[0], 'arg-char-test.c', c_args: args)
|
||||
test('arg-char-' + s[0], e, args: s[1])
|
||||
endforeach
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"installed": [
|
||||
{"type": "file", "file": "usr/share/result"},
|
||||
{"type": "file", "file": "usr/share/result2"}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user