From 3d9e41aa60a943a07ebe2232577db7dfc6a371a3 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Tue, 29 Sep 2020 20:51:23 +0200 Subject: [PATCH] Fix version-dependent SBEtests by introducing \SqVersionSwitch --- Collections/Collections.tex | 2 +- common.tex | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Collections/Collections.tex b/Collections/Collections.tex index 231872f9..c6386370 100644 --- a/Collections/Collections.tex +++ b/Collections/Collections.tex @@ -867,7 +867,7 @@ \subsection{Other messages} \paragraph{\mthind{Collection}{count:}} The message \ct{count:} returns the number of elements satisfying a condition. The condition is represented as a boolean block. \begin{code}{@TEST} -Smalltalk allClasses count: [:each | 'Collection*' match: each asString ] --> 4 +Smalltalk allClasses count: [:each | 'Collection*' match: each asString ] --> !\SqVersionSwitch{6.0}{4}{2}! \end{code} \paragraph{\mthind{Collection}{includes:}} The message \ct{includes:} checks whether the argument is contained in the collection. diff --git a/common.tex b/common.tex index 07cef541..b4bf554f 100644 --- a/common.tex +++ b/common.tex @@ -543,9 +543,27 @@ \setcounter{totalnumber}{20} \setcounter{dbltopnumber}{9} %============================================================= -% apb doesn't like paragraphs to run in to each other without a break +% apb doesn't like paragraphs to run into each other without a break \parskip 1ex %============================================================= +\usepackage{pdftexcmds} +\makeatletter +\newcommand\compareStringsDo[4]{% + \lowercase{\ifcase\pdf@strcmp{#1}{#2}}% + #4\or + #4\else + #3\fi +} +\makeatother +% Usage: \SqVersionSwitch{6.0}{We are Squeak 6.0 or later!}{We are before Squeak 6.0} +\newcommand{\SqVersionSwitch}[3]{% + \ifdefined\SQUEAKVERSION% + \compareStringsDo{\SQUEAKVERSION}{#1}{#2}{#3}% + \else% + #1% + \fi% +} +%============================================================= %:Stuff to check, merge or deprecate %\setlength{\marginparsep}{2mm} %\renewcommand{\baselinestretch}{1.1}