...
1#!/usr/bin/env bats
2
3load common
4
5@test "prelude_str.mk: NL" {
6 # Honestly, this checks `quote.shell` more than it does NL.
7 check_expr_eq strict '$(NL)' $'\n'
8}
9
10@test "prelude_str.mk: SPACE" {
11 # Honestly, this checks `quote.shell` more than it does SPACE.
12 check_expr_eq strict '$(SPACE)' ' '
13}
14
15@test "prelude_str.mk: str.eq" {
16 cat >>Makefile <<-'__EOT__'
17 include build-aux/prelude.mk
18 test = $(info ("$1" == "$2") => $(if $(call str.eq,$1,$2),$$(TRUE),$$(FALSE)))
19 $(call test,foo,foo)
20 $(call test,foo,bar)
21 $(call test,bar,bar)
22 $(call test,f%,foo)
23 $(call test,foo,f%)
24 $(call test,f%,f%)
25 tst: noop
26 noop: ; @true
27 .PHONY: noop
28 __EOT__
29
30 make >actual
31 printf '("%s" == "%s") => $(%s)\n' >expected \
32 foo foo TRUE \
33 foo bar FALSE \
34 bar bar TRUE \
35 f% foo FALSE \
36 foo f% FALSE \
37 f% f% TRUE
38 diff -u expected actual
39}
View as plain text