read the feature flags in sextest in the way sexc does
sextest resolves #+ and #- itself -- it reads the program and prints what survives to sexc -- so a flag spelling it does not recognise decides which branch gets compiled
This commit was merged in pull request #31.
This commit is contained in:
25
tests/sex-programs/feature-flags.sex
Normal file
25
tests/sex-programs/feature-flags.sex
Normal file
@@ -0,0 +1,25 @@
|
||||
(compilation "-f alpha -f beta,gamma --features=delta --no-platform-features")
|
||||
(input)
|
||||
(output "alpha" "beta" "gamma" "delta" "elsewhere")
|
||||
(return 0)
|
||||
|
||||
;;; The flags naming the features, in every spelling sexc takes. This
|
||||
;;; is not pedantry about the command line: sextest reads the program
|
||||
;;; itself and prints the surviving forms to sexc, so a spelling it
|
||||
;;; does not recognise leaves the guards below resolved against the
|
||||
;;; wrong set -- quietly, since the test then checks the output of a
|
||||
;;; program it did not mean to compile.
|
||||
;;;
|
||||
;;; --no-platform-features is what makes `#-unix' true wherever this is
|
||||
;;; compiled, and it has to be honoured on both sides for that to hold.
|
||||
|
||||
(include stdio.h)
|
||||
|
||||
(pub fn main () int
|
||||
#+alpha (puts "alpha")
|
||||
#+beta (puts "beta")
|
||||
#+gamma (puts "gamma")
|
||||
#+delta (puts "delta")
|
||||
#-unix (puts "elsewhere")
|
||||
#+unix (puts "here")
|
||||
(return 0))
|
||||
Reference in New Issue
Block a user