rules: add tests demonstrating mnemonic descriptions

This commit is contained in:
William Ballenthin
2021-05-18 13:35:24 -06:00
parent 7b62b589f7
commit ec5cec619d
2 changed files with 3 additions and 2 deletions

View File

@@ -5,8 +5,6 @@
# Unless required by applicable law or agreed to in writing, software distributed under the License # Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License. # See the License for the specific language governing permissions and limitations under the License.
import sys
import viv_utils import viv_utils
import envi.memory import envi.memory
import viv_utils.flirt import viv_utils.flirt

View File

@@ -83,6 +83,7 @@ def test_rule_descriptions():
description: string description description: string description
- string: '/myregex/' - string: '/myregex/'
description: regex description description: regex description
- mnemonic: inc = mnemonic description
# TODO - count(number(2 = number description)): 2 # TODO - count(number(2 = number description)): 2
- or: - or:
- description: or description - description: or description
@@ -104,6 +105,8 @@ def test_rule_descriptions():
for child in statement.get_children(): for child in statement.get_children():
rec(child) rec(child)
else: else:
if isinstance(statement.value, str):
assert "description" not in statement.value
assert statement.description == statement.name + " description" assert statement.description == statement.name + " description"
rec(r.statement) rec(r.statement)