Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
SHTK_UNITTEST_ASSERT_... BSD Library Functions Manual SHTK_UNITTEST_ASSERT_...

NAME
     shtk_unittest_assert_file -- Validates the	contents of a file against
     golden data

LIBRARY
     shtk_import unittest

SYNOPSIS
     shtk_unittest_assert_file golden_spec actual_file

DESCRIPTION
     The shtk_unittest_assert_file function verifies that actual_file, which
     must exist, matches some predefined contents specified by golden_spec.

     The valid values for golden_spec are of the form:

	   empty
		 actual_file must be empty.

	   not-empty
		 actual_file must not be empty.

	   ignore
		 The contents of actual_file are irrelevant.

	   file:_path_
		 The contents of actual_file must match	the contents of	the
		 file path.

	   inline:_text_
		 The contents of actual_file must match	the inline contents
		 provided in text.  Note that text can include escape se-
		 quences.

	   match:_regexp_
		 The contents of actual_file must match	the given regular ex-
		 pression in regexp.

	   not-match:_regexp_
		 The contents of actual_file must not match the	given regular
		 expression in regexp.

	   save:_path_
		 actual_file is	saved to path for further inspection by	the
		 test case.  This is not useful	in the context of
		 shtk_unittest_assert_file but comes in	handy when used	in
		 conjunction of	shtk_unittest_assert_command(3).

	   stdin
		 The contents of actual_file must match	the golden contents
		 provided via the standard input.

EXAMPLES
     The following examples all	pass:

	   touch my_file
	   assert_file empty my_file

	   echo	"foo" >my_file
	   assert_file inline:"foo\n" my_file

	   echo	"bar" >>my_file
	   cp my_file golden
	   assert_file file:golden my_file
	   assert_file stdin my_file <golden

	   assert_file match:"fo" my_file
	   assert_file not-match:"abcde" my_file

SEE ALSO
     shtk(3), shtk_unittest(3)

HISTORY
     shtk_unittest_assert_file first appeared in shtk 1.6.

BSD			       November	9, 2014				   BSD

NAME | LIBRARY | SYNOPSIS | DESCRIPTION | EXAMPLES | SEE ALSO | HISTORY

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=shtk_unittest_assert_file&sektion=3&manpath=FreeBSD+12.0-RELEASE+and+Ports>

home | help