Skip to content

Commit

Permalink
Fix version-dependent SBEtests by introducing \SqVersionSwitch
Browse files Browse the repository at this point in the history
  • Loading branch information
LinqLover committed Sep 29, 2020
1 parent a2536aa commit 3d9e41a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Collections/Collections.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
20 changes: 19 additions & 1 deletion common.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 3d9e41a

Please sign in to comment.