From f0b7cf0fa6c6e922d624c7890f6b947a442c50db Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Mon, 15 Apr 2024 16:54:28 +0300 Subject: [PATCH 1/8] Add test:number and test:plural function definitions --- test/README.md | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/test/README.md b/test/README.md index ac0aecf94..e8aa376d9 100644 --- a/test/README.md +++ b/test/README.md @@ -35,3 +35,78 @@ Some examples of test harnesses using these tests, from the source repository: - [CST parse/stringify tests](https://github.com/messageformat/messageformat/blob/11c95dab2b25db8454e49ff4daadb817e1d5b770/packages/mf2-messageformat/src/cst/cst.test.ts) - [Data model stringify tests](https://github.com/messageformat/messageformat/blob/11c95dab2b25db8454e49ff4daadb817e1d5b770/packages/mf2-messageformat/src/data-model/stringify.test.ts) - [Formatting tests](https://github.com/messageformat/messageformat/blob/11c95dab2b25db8454e49ff4daadb817e1d5b770/packages/mf2-messageformat/src/messageformat.test.ts) + +## Test Functions + +As the behaviour of `:number`, `:datetime`, and other default message functions +is dependent on locale-specific data and may vary between implementations, +the following functions are defined for test use only: + +### `test:number` + +This function is valid both as a selector and as a formatter. +The only option it recognizes is `fractionDigits`, +all other option values passed to it are ignored. + +When resolving a `test:number` expression, +its internal _input_ and _fractionDigits_ values are determined as follows: +1. If the expression argument resolves to a numerical value + or a string matching the `number-literal` production, then + 1. Let _input_ be the numerical value of the argument. +2. Else, + 1. Emit "bad-input" error. + 1. Use a fallback representation is used as the resolved value of the expression. + The _fractionDigits_ value is not determined. +3. If the `fractionDigits` option is set, then + 1. If its value resolves to a numerical integer value `0`, `1` or `2`, + or their corresponding string representations `'0'`, `'1'`, or `'2'`, then + 1. Let _fractionDigits_ be the numerical value of the option. + 2. Else, + 1. Emit "bad-option" error. + 2. Let _fractionDigits_ be `0`. +4. Else, + 1. Let _fractionDigits_ be `0`. + +When `test:number` is used as a selector, +the behaviour of calling it as the `rv` value of MatchSelectorKeys(`rv`, `keys`) +(see [Resolve Preferences](/spec/formatting.md#resolve-preferences) for more information) +depends on its _input_ and _fractionDigits_ values. +- If the _input_ is `1` and _fractionDigits_ is `0`, + the method will return some slice of the list « `'1'`, `'one'` », + depending on whether those values are included in `keys`. +- If the _input_ is `1` and _fractionDigits_ is not `0`, + the method will return the list « `'1'` » if `keys` includes `'1'`, or an empty list otherwise. +- If the _input_ is any other value, the method will return an empty list. + +When an expression with a `test:number` annotation is assigned to a variable by a declaration +and that variable is used as an argument or option value, +its resolved value is the _input_ value. + +When `test:number` is used as a formatter, +a placeholder resolving to a value with a `test:number` expression +is formatted as a concatenation of the following parts: +1. If _input_ is less than `0`, the character `-` U+002D Hyphen-Minus. +2. The truncated absolute integer value of _input_, i.e. floor(abs(_input_)), + formatted as a sequence of decimal digit caharacters. +3. If _fractionDigits_ is `1`, then + 1. The character `.` U+002E Full Stop. + 2. The single decimal digit character representing the value floor((abs(_input_) - floor(abs(_input_))) * 10) +4. Else if _fractionDigits_ is `2`, then + 1. The character `.` U+002E Full Stop. + 2. The two decimal digit character string representing the value floor((abs(_input_) - floor(abs(_input_))) * 100), + with a `0` U+0030 Digit Zero padding at start if the result is less than `10`. + +If the formatting target is a sequence of parts, +each of the above parts will be emitted separately +rather than being concatenated into a single string. + +Note that for purposes of clarity, the formatting of `test:number` does not perform any rounding. + +### `test:plural` + +This function behaves exactly the same as `test:number`, +except that it cannot be used for formatting. + +When `test:plural` is used as a formatter, +a "not-formattable" error is emitted and the placeholder is formatted with +a fallback representation. From bf0a30f0cf663c743a77e6203bd20f92ea29dd2b Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Tue, 16 Apr 2024 11:46:10 +0300 Subject: [PATCH 2/8] Rename as test:func & test:select, add test:format --- test/README.md | 100 +++++++++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 44 deletions(-) diff --git a/test/README.md b/test/README.md index e8aa376d9..b53d5ca82 100644 --- a/test/README.md +++ b/test/README.md @@ -40,73 +40,85 @@ Some examples of test harnesses using these tests, from the source repository: As the behaviour of `:number`, `:datetime`, and other default message functions is dependent on locale-specific data and may vary between implementations, -the following functions are defined for test use only: +the following functions are defined for **test use only**: -### `test:number` +### `test:func` This function is valid both as a selector and as a formatter. -The only option it recognizes is `fractionDigits`, +The only option it recognizes is `fd`, all other option values passed to it are ignored. -When resolving a `test:number` expression, -its internal _input_ and _fractionDigits_ values are determined as follows: -1. If the expression argument resolves to a numerical value +When resolving a `test:func` expression, +its _Input_ and _FD_ values are determined as follows: + +1. Let _FD_ be `0`. +1. Let _arg_ be the resolved value of the expression argument. +1. If _arg_ is the resolved value of an expression + with a `test:func`, `test:select`, or `test:format` annotation + for which resolution has succeeded, then + 1. Let _Input_ be the _Input_ value of _arg_. + 1. Set _FD_ to be _FD_ value of _arg_. +1. Else if _arg_ is a numerical value or a string matching the `number-literal` production, then - 1. Let _input_ be the numerical value of the argument. -2. Else, - 1. Emit "bad-input" error. - 1. Use a fallback representation is used as the resolved value of the expression. - The _fractionDigits_ value is not determined. -3. If the `fractionDigits` option is set, then - 1. If its value resolves to a numerical integer value `0`, `1` or `2`, - or their corresponding string representations `'0'`, `'1'`, or `'2'`, then - 1. Let _fractionDigits_ be the numerical value of the option. - 2. Else, - 1. Emit "bad-option" error. - 2. Let _fractionDigits_ be `0`. -4. Else, - 1. Let _fractionDigits_ be `0`. - -When `test:number` is used as a selector, + 1. Let _Input_ be the numerical value of _arg_. +1. Else, + 1. Emit "bad-input" Resolution Error. + 1. Use a fallback representation as the resolved value of the expression. + Further steps of this algorithm are not followed. +1. If the `fd` option is set, then + 1. If its value resolves to a numerical integer value `0` or `1` + or their corresponding string representations `'0'` or `'1'`, then + 1. Set _FD_ to be the numerical value of the option. + 1. Else if its value is not an unresolved value set by [Option Resolution](/spec/formatting.md#option-resolution), + 1. Emit "bad-option" Resolution Error. + 1. Use a fallback representation as the resolved value of the expression. + +When `test:func` is used as a selector, the behaviour of calling it as the `rv` value of MatchSelectorKeys(`rv`, `keys`) (see [Resolve Preferences](/spec/formatting.md#resolve-preferences) for more information) -depends on its _input_ and _fractionDigits_ values. -- If the _input_ is `1` and _fractionDigits_ is `0`, - the method will return some slice of the list « `'1'`, `'one'` », +depends on its _Input_ and _FD_ values. + +- If the _Input_ is `1` and _FD_ is `1`, + the method will return some slice of the list « `'1.0'`, `'1'` », depending on whether those values are included in `keys`. -- If the _input_ is `1` and _fractionDigits_ is not `0`, +- If the _Input_ is `1` and _FD_ is `0`, the method will return the list « `'1'` » if `keys` includes `'1'`, or an empty list otherwise. -- If the _input_ is any other value, the method will return an empty list. +- If the _Input_ is any other value, the method will return an empty list. -When an expression with a `test:number` annotation is assigned to a variable by a declaration -and that variable is used as an argument or option value, -its resolved value is the _input_ value. +When an expression with a `test:func` annotation is assigned to a variable by a declaration +and that variable is used as an option value, +its resolved value is the _Input_ value. -When `test:number` is used as a formatter, -a placeholder resolving to a value with a `test:number` expression +When `test:func` is used as a formatter, +a placeholder resolving to a value with a `test:func` expression is formatted as a concatenation of the following parts: -1. If _input_ is less than `0`, the character `-` U+002D Hyphen-Minus. -2. The truncated absolute integer value of _input_, i.e. floor(abs(_input_)), + +1. If _Input_ is less than `0`, the character `-` U+002D Hyphen-Minus. +1. The truncated absolute integer value of _Input_, i.e. floor(abs(_Input_)), formatted as a sequence of decimal digit caharacters. -3. If _fractionDigits_ is `1`, then - 1. The character `.` U+002E Full Stop. - 2. The single decimal digit character representing the value floor((abs(_input_) - floor(abs(_input_))) * 10) -4. Else if _fractionDigits_ is `2`, then +1. If _FD_ is `1`, then 1. The character `.` U+002E Full Stop. - 2. The two decimal digit character string representing the value floor((abs(_input_) - floor(abs(_input_))) * 100), - with a `0` U+0030 Digit Zero padding at start if the result is less than `10`. + 1. The single decimal digit character representing the value floor((abs(_Input_) - floor(abs(_Input_))) \* 10) If the formatting target is a sequence of parts, each of the above parts will be emitted separately rather than being concatenated into a single string. -Note that for purposes of clarity, the formatting of `test:number` does not perform any rounding. +Note that for purposes of clarity, the formatting of `test:func` does not perform any rounding. -### `test:plural` +### `test:select` -This function behaves exactly the same as `test:number`, +This function behaves exactly the same as `test:func`, except that it cannot be used for formatting. -When `test:plural` is used as a formatter, +When `test:select` is used as a formatter, a "not-formattable" error is emitted and the placeholder is formatted with a fallback representation. + +### `test:format` + +This function behaves exactly the same as `test:func`, +except that it cannot be used for selection. + +When `test:format` is used as a selector, +the steps under 2.iii. of [Resolve Selectors](/spec/formatting.md#resolve-selectors) are followed. From 1340f79e16c6e48ad29bb773861f5f6e2e72c07e Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Wed, 17 Apr 2024 10:56:23 +0300 Subject: [PATCH 3/8] Apply suggestions from code review --- test/README.md | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/test/README.md b/test/README.md index b53d5ca82..f83318e8e 100644 --- a/test/README.md +++ b/test/README.md @@ -38,23 +38,24 @@ Some examples of test harnesses using these tests, from the source repository: ## Test Functions -As the behaviour of `:number`, `:datetime`, and other default message functions +As the behaviour of some of the default registry functions +such as `:number` and `:datetime` is dependent on locale-specific data and may vary between implementations, the following functions are defined for **test use only**: -### `test:func` +### `:test:function` This function is valid both as a selector and as a formatter. The only option it recognizes is `fd`, all other option values passed to it are ignored. -When resolving a `test:func` expression, +When resolving a `:test:function` expression, its _Input_ and _FD_ values are determined as follows: 1. Let _FD_ be `0`. -1. Let _arg_ be the resolved value of the expression argument. +1. Let _arg_ be the resolved value of the expression operand. 1. If _arg_ is the resolved value of an expression - with a `test:func`, `test:select`, or `test:format` annotation + with a `:test:function`, `:test:select`, or `:test:format` annotation for which resolution has succeeded, then 1. Let _Input_ be the _Input_ value of _arg_. 1. Set _FD_ to be _FD_ value of _arg_. @@ -73,7 +74,7 @@ its _Input_ and _FD_ values are determined as follows: 1. Emit "bad-option" Resolution Error. 1. Use a fallback representation as the resolved value of the expression. -When `test:func` is used as a selector, +When `:test:function` is used as a selector, the behaviour of calling it as the `rv` value of MatchSelectorKeys(`rv`, `keys`) (see [Resolve Preferences](/spec/formatting.md#resolve-preferences) for more information) depends on its _Input_ and _FD_ values. @@ -85,12 +86,12 @@ depends on its _Input_ and _FD_ values. the method will return the list « `'1'` » if `keys` includes `'1'`, or an empty list otherwise. - If the _Input_ is any other value, the method will return an empty list. -When an expression with a `test:func` annotation is assigned to a variable by a declaration +When an expression with a `:test:function` annotation is assigned to a variable by a declaration and that variable is used as an option value, its resolved value is the _Input_ value. -When `test:func` is used as a formatter, -a placeholder resolving to a value with a `test:func` expression +When `:test:function` is used as a formatter, +a placeholder resolving to a value with a `:test:function` expression is formatted as a concatenation of the following parts: 1. If _Input_ is less than `0`, the character `-` U+002D Hyphen-Minus. @@ -104,21 +105,21 @@ If the formatting target is a sequence of parts, each of the above parts will be emitted separately rather than being concatenated into a single string. -Note that for purposes of clarity, the formatting of `test:func` does not perform any rounding. +Note that for purposes of clarity, the formatting of `:test:function` does not perform any rounding. -### `test:select` +### `:test:select` -This function behaves exactly the same as `test:func`, +This function behaves exactly the same as `:test:function`, except that it cannot be used for formatting. -When `test:select` is used as a formatter, +When `:test:select` is used as a formatter, a "not-formattable" error is emitted and the placeholder is formatted with a fallback representation. -### `test:format` +### `:test:format` -This function behaves exactly the same as `test:func`, +This function behaves exactly the same as `:test:function`, except that it cannot be used for selection. -When `test:format` is used as a selector, +When `:test:format` is used as a selector, the steps under 2.iii. of [Resolve Selectors](/spec/formatting.md#resolve-selectors) are followed. From 00a981a67b20d143ca60a984365891d6238b4e35 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Sun, 21 Apr 2024 16:56:40 +0300 Subject: [PATCH 4/8] Add "Operands" and "Options" sections to look like registry.md function definitions --- test/README.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/test/README.md b/test/README.md index f83318e8e..b4659ec34 100644 --- a/test/README.md +++ b/test/README.md @@ -46,8 +46,19 @@ the following functions are defined for **test use only**: ### `:test:function` This function is valid both as a selector and as a formatter. -The only option it recognizes is `fd`, -all other option values passed to it are ignored. + +#### Operands + +The function `:test:function` requires a [Number Operand](/spec/registry.md#number-operands) as its _operand_. + +#### Options + +The only option `:test:function` recognizes is `fd`, +a [digit size option](/spec/registry.md) for which only `0` and `1` are valid values. + +All other options and their values are ignored. + +#### Behavior When resolving a `:test:function` expression, its _Input_ and _FD_ values are determined as follows: @@ -109,7 +120,8 @@ Note that for purposes of clarity, the formatting of `:test:function` does not p ### `:test:select` -This function behaves exactly the same as `:test:function`, +This function accepts the same operands and options, +and behaves exactly the same as `:test:function`, except that it cannot be used for formatting. When `:test:select` is used as a formatter, @@ -118,7 +130,8 @@ a fallback representation. ### `:test:format` -This function behaves exactly the same as `:test:function`, +This function accepts the same operands and options, +and behaves exactly the same as `:test:function`, except that it cannot be used for selection. When `:test:format` is used as a selector, From 52f1a723323adb4ec1211d91b6c0c5e5dd19ba2f Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Mon, 29 Apr 2024 19:02:09 +0300 Subject: [PATCH 5/8] Apply suggestions from code review Co-authored-by: Addison Phillips --- test/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/README.md b/test/README.md index b3bc72fb1..bb45763f1 100644 --- a/test/README.md +++ b/test/README.md @@ -42,7 +42,7 @@ The function `:test:function` requires a [Number Operand](/spec/registry.md#numb #### Options The only option `:test:function` recognizes is `fd`, -a [digit size option](/spec/registry.md) for which only `0` and `1` are valid values. +a _digit size option_ for which only `0` and `1` are valid values. All other options and their values are ignored. @@ -95,7 +95,7 @@ is formatted as a concatenation of the following parts: 1. If _Input_ is less than `0`, the character `-` U+002D Hyphen-Minus. 1. The truncated absolute integer value of _Input_, i.e. floor(abs(_Input_)), - formatted as a sequence of decimal digit caharacters. + formatted as a sequence of decimal digit characters (U+0030...U+0039). 1. If _FD_ is `1`, then 1. The character `.` U+002E Full Stop. 1. The single decimal digit character representing the value floor((abs(_Input_) - floor(abs(_Input_))) \* 10) From b63b2f29f5108926289f2edad6bb5d4034442e05 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Mon, 6 May 2024 10:19:09 +0300 Subject: [PATCH 6/8] Linkify all the things --- test/README.md | 84 +++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/test/README.md b/test/README.md index bb45763f1..5721794b4 100644 --- a/test/README.md +++ b/test/README.md @@ -26,14 +26,14 @@ For users of Visual Studio Code, a [settings file](./.vscode/settings.json) is i ## Test Functions -As the behaviour of some of the default registry functions +As the behaviour of some of the default registry _functions_ such as `:number` and `:datetime` is dependent on locale-specific data and may vary between implementations, -the following functions are defined for **test use only**: +the following _functions_ are defined for **test use only**: ### `:test:function` -This function is valid both as a selector and as a formatter. +This function is valid both as a _selector_ and as a _formatter_. #### Operands @@ -41,64 +41,64 @@ The function `:test:function` requires a [Number Operand](/spec/registry.md#numb #### Options -The only option `:test:function` recognizes is `fd`, +The only _option_ `:test:function` recognizes is `fd`, a _digit size option_ for which only `0` and `1` are valid values. -All other options and their values are ignored. +All other _options_ and their values are ignored. #### Behavior When resolving a `:test:function` expression, -its _Input_ and _FD_ values are determined as follows: +its `Input` and `FD` values are determined as follows: -1. Let _FD_ be `0`. -1. Let _arg_ be the resolved value of the expression operand. -1. If _arg_ is the resolved value of an expression - with a `:test:function`, `:test:select`, or `:test:format` annotation +1. Let `FD` be 0. +1. Let `arg` be the resolved value of the _expression_ _operand_. +1. If `arg` is the resolved value of an _expression_ + with a `:test:function`, `:test:select`, or `:test:format` _annotation_ for which resolution has succeeded, then - 1. Let _Input_ be the _Input_ value of _arg_. - 1. Set _FD_ to be _FD_ value of _arg_. -1. Else if _arg_ is a numerical value + 1. Let `Input` be the `Input` value of `arg`. + 1. Set `FD` to be `FD` value of `arg`. +1. Else if `arg` is a numerical value or a string matching the `number-literal` production, then - 1. Let _Input_ be the numerical value of _arg_. + 1. Let `Input` be the numerical value of `arg`. 1. Else, - 1. Emit "bad-input" Resolution Error. - 1. Use a fallback representation as the resolved value of the expression. + 1. Emit "bad-input" _Resolution Error_. + 1. Use a _fallback value_ as the resolved value of the _expression_. Further steps of this algorithm are not followed. -1. If the `fd` option is set, then - 1. If its value resolves to a numerical integer value `0` or `1` +1. If the `fd` _option_ is set, then + 1. If its value resolves to a numerical integer value 0 or 1 or their corresponding string representations `'0'` or `'1'`, then - 1. Set _FD_ to be the numerical value of the option. - 1. Else if its value is not an unresolved value set by [Option Resolution](/spec/formatting.md#option-resolution), - 1. Emit "bad-option" Resolution Error. - 1. Use a fallback representation as the resolved value of the expression. + 1. Set `FD` to be the numerical value of the _option_. + 1. Else if its value is not an unresolved value set by _option resolution_, + 1. Emit "bad-option" _Resolution Error_. + 1. Use a _fallback value_ as the resolved value of the _expression_. -When `:test:function` is used as a selector, +When `:test:function` is used as a _selector_, the behaviour of calling it as the `rv` value of MatchSelectorKeys(`rv`, `keys`) (see [Resolve Preferences](/spec/formatting.md#resolve-preferences) for more information) -depends on its _Input_ and _FD_ values. +depends on its `Input` and `FD` values. -- If the _Input_ is `1` and _FD_ is `1`, +- If the `Input` is 1 and `FD` is 1, the method will return some slice of the list « `'1.0'`, `'1'` », depending on whether those values are included in `keys`. -- If the _Input_ is `1` and _FD_ is `0`, +- If the `Input` is 1 and `FD` is 0, the method will return the list « `'1'` » if `keys` includes `'1'`, or an empty list otherwise. -- If the _Input_ is any other value, the method will return an empty list. +- If the `Input` is any other value, the method will return an empty list. -When an expression with a `:test:function` annotation is assigned to a variable by a declaration -and that variable is used as an option value, -its resolved value is the _Input_ value. +When an _expression_ with a `:test:function` _annotation_ is assigned to a _variable_ by a _declaration_ +and that _variable_ is used as an _option_ value, +its resolved value is the `Input` value. -When `:test:function` is used as a formatter, -a placeholder resolving to a value with a `:test:function` expression +When `:test:function` is used as a _formatter_, +a _placeholder_ resolving to a value with a `:test:function` _expression_ is formatted as a concatenation of the following parts: -1. If _Input_ is less than `0`, the character `-` U+002D Hyphen-Minus. -1. The truncated absolute integer value of _Input_, i.e. floor(abs(_Input_)), +1. If `Input` is less than 0, the character `-` U+002D Hyphen-Minus. +1. The truncated absolute integer value of `Input`, i.e. floor(abs(`Input`)), formatted as a sequence of decimal digit characters (U+0030...U+0039). -1. If _FD_ is `1`, then +1. If `FD` is 1, then 1. The character `.` U+002E Full Stop. - 1. The single decimal digit character representing the value floor((abs(_Input_) - floor(abs(_Input_))) \* 10) + 1. The single decimal digit character representing the value floor((abs(`Input`) - floor(abs(`Input`))) \* 10) If the formatting target is a sequence of parts, each of the above parts will be emitted separately @@ -108,19 +108,19 @@ Note that for purposes of clarity, the formatting of `:test:function` does not p ### `:test:select` -This function accepts the same operands and options, +This _function_ accepts the same _operands_ and _options_, and behaves exactly the same as `:test:function`, except that it cannot be used for formatting. -When `:test:select` is used as a formatter, -a "not-formattable" error is emitted and the placeholder is formatted with -a fallback representation. +When `:test:select` is used as a _formatter_, +a "not-formattable" error is emitted and the _placeholder_ is formatted with +a _fallback value_. ### `:test:format` -This function accepts the same operands and options, +This _function_ accepts the same _operands_ and _options_, and behaves exactly the same as `:test:function`, except that it cannot be used for selection. -When `:test:format` is used as a selector, +When `:test:format` is used as a _selector_, the steps under 2.iii. of [Resolve Selectors](/spec/formatting.md#resolve-selectors) are followed. From dbcb2ce1111c5d15bba0320ba8862ae0de4a6273 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Mon, 6 May 2024 10:21:25 +0300 Subject: [PATCH 7/8] Drop note about not rounding --- test/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/test/README.md b/test/README.md index 5721794b4..9a61766b0 100644 --- a/test/README.md +++ b/test/README.md @@ -104,7 +104,6 @@ If the formatting target is a sequence of parts, each of the above parts will be emitted separately rather than being concatenated into a single string. -Note that for purposes of clarity, the formatting of `:test:function` does not perform any rounding. ### `:test:select` From c5aa1b957652ab3cbd7812cd2df11987f5b26c32 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Wed, 8 May 2024 10:18:54 +0300 Subject: [PATCH 8/8] Rename FD as DecimalPlaces --- test/README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/README.md b/test/README.md index 9a61766b0..0a43cef9c 100644 --- a/test/README.md +++ b/test/README.md @@ -41,7 +41,7 @@ The function `:test:function` requires a [Number Operand](/spec/registry.md#numb #### Options -The only _option_ `:test:function` recognizes is `fd`, +The only _option_ `:test:function` recognizes is `decimalPlaces`, a _digit size option_ for which only `0` and `1` are valid values. All other _options_ and their values are ignored. @@ -49,15 +49,15 @@ All other _options_ and their values are ignored. #### Behavior When resolving a `:test:function` expression, -its `Input` and `FD` values are determined as follows: +its `Input` and `DecimalPlaces` values are determined as follows: -1. Let `FD` be 0. +1. Let `DecimalPlaces` be 0. 1. Let `arg` be the resolved value of the _expression_ _operand_. 1. If `arg` is the resolved value of an _expression_ with a `:test:function`, `:test:select`, or `:test:format` _annotation_ for which resolution has succeeded, then 1. Let `Input` be the `Input` value of `arg`. - 1. Set `FD` to be `FD` value of `arg`. + 1. Set `DecimalPlaces` to be `DecimalPlaces` value of `arg`. 1. Else if `arg` is a numerical value or a string matching the `number-literal` production, then 1. Let `Input` be the numerical value of `arg`. @@ -65,10 +65,10 @@ its `Input` and `FD` values are determined as follows: 1. Emit "bad-input" _Resolution Error_. 1. Use a _fallback value_ as the resolved value of the _expression_. Further steps of this algorithm are not followed. -1. If the `fd` _option_ is set, then +1. If the `decimalPlaces` _option_ is set, then 1. If its value resolves to a numerical integer value 0 or 1 or their corresponding string representations `'0'` or `'1'`, then - 1. Set `FD` to be the numerical value of the _option_. + 1. Set `DecimalPlaces` to be the numerical value of the _option_. 1. Else if its value is not an unresolved value set by _option resolution_, 1. Emit "bad-option" _Resolution Error_. 1. Use a _fallback value_ as the resolved value of the _expression_. @@ -76,12 +76,12 @@ its `Input` and `FD` values are determined as follows: When `:test:function` is used as a _selector_, the behaviour of calling it as the `rv` value of MatchSelectorKeys(`rv`, `keys`) (see [Resolve Preferences](/spec/formatting.md#resolve-preferences) for more information) -depends on its `Input` and `FD` values. +depends on its `Input` and `DecimalPlaces` values. -- If the `Input` is 1 and `FD` is 1, +- If the `Input` is 1 and `DecimalPlaces` is 1, the method will return some slice of the list « `'1.0'`, `'1'` », depending on whether those values are included in `keys`. -- If the `Input` is 1 and `FD` is 0, +- If the `Input` is 1 and `DecimalPlaces` is 0, the method will return the list « `'1'` » if `keys` includes `'1'`, or an empty list otherwise. - If the `Input` is any other value, the method will return an empty list. @@ -96,7 +96,7 @@ is formatted as a concatenation of the following parts: 1. If `Input` is less than 0, the character `-` U+002D Hyphen-Minus. 1. The truncated absolute integer value of `Input`, i.e. floor(abs(`Input`)), formatted as a sequence of decimal digit characters (U+0030...U+0039). -1. If `FD` is 1, then +1. If `DecimalPlaces` is 1, then 1. The character `.` U+002E Full Stop. 1. The single decimal digit character representing the value floor((abs(`Input`) - floor(abs(`Input`))) \* 10)