Skip to content

Commit

Permalink
interenaltests: Add some version strings with ansi escapes in them
Browse files Browse the repository at this point in the history
AS we've run into a few programs using ansi escapes in their version
outputs, we'd like to test them as well.
  • Loading branch information
dcbaker committed Jul 30, 2021
1 parent 82e92e9 commit a450f8c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions unittests/internaltests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from configparser import ConfigParser
from pathlib import Path
import typing as T
import unittest

import mesonbuild.mlog
import mesonbuild.depfile
Expand Down Expand Up @@ -64,6 +65,16 @@ def test_version_number(self):
self.assertEqual(search_version('oops v1.2.3'), '1.2.3')
self.assertEqual(search_version('2016.oops 1.2.3'), '1.2.3')
self.assertEqual(search_version('2016.x'), 'unknown version')
self.assertEqual(search_version(r'something version is \033[32;2m1.2.0\033[0m.'), '1.2.0')

# Literal output of mvn
self.assertEqual(search_version(r'''\
\033[1mApache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)\033[0m
Maven home: /nix/store/g84a9wnid2h1d3z2wfydy16dky73wh7i-apache-maven-3.8.1/maven
Java version: 11.0.10, vendor: Oracle Corporation, runtime: /nix/store/afsnl4ahmm9svvl7s1a0cj41vw4nkmz4-openjdk-11.0.10+9/lib/openjdk
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.12.17", arch: "amd64", family: "unix"'''),
'3.8.1')

def test_mode_symbolic_to_bits(self):
modefunc = mesonbuild.mesonlib.FileMode.perms_s_to_bits
Expand Down

0 comments on commit a450f8c

Please sign in to comment.