mirror of
https://github.com/rwinkhart/go-highlite.git
synced 2026-08-28 04:46:30 -04:00
Commit test inputs
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
module gohighlight
|
||||
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/jessp01/gohighlight v0.21.1-1
|
||||
github.com/zyedidia/highlight v0.0.0-20200217010119-291680feaca1
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
#include <stdio.h>
|
||||
int main(int argc, char *argv[]) {
|
||||
printf("%s\n", "Hello world!");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
# set the project name and version
|
||||
project(Tutorial VERSION 1.0)
|
||||
|
||||
set(CMAKE_DEBUG_POSTFIX d)
|
||||
|
||||
add_library(tutorial_compiler_flags INTERFACE)
|
||||
target_compile_features(tutorial_compiler_flags INTERFACE cxx_std_11)
|
||||
|
||||
# add compiler warning flags just when building this project via
|
||||
# the BUILD_INTERFACE genex
|
||||
set(gcc_like_cxx "$<COMPILE_LANG_AND_ID:CXX,ARMClang,AppleClang,Clang,GNU,LCC>")
|
||||
set(msvc_cxx "$<COMPILE_LANG_AND_ID:CXX,MSVC>")
|
||||
target_compile_options(tutorial_compiler_flags INTERFACE
|
||||
"$<${gcc_like_cxx}:$<BUILD_INTERFACE:-Wall;-Wextra;-Wshadow;-Wformat=2;-Wunused>>"
|
||||
"$<${msvc_cxx}:$<BUILD_INTERFACE:-W3>>"
|
||||
)
|
||||
|
||||
# control where the static and shared libraries are built so that on windows
|
||||
# we don't need to tinker with the path to run the executable
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
|
||||
elseif(UNIX)
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
|
||||
endif()
|
||||
|
||||
# configure a header file to pass the version number only
|
||||
configure_file(TutorialConfig.h.in TutorialConfig.h)
|
||||
|
||||
# add the MathFunctions library
|
||||
add_subdirectory(MathFunctions)
|
||||
|
||||
# add the executable
|
||||
add_executable(Tutorial tutorial.cxx)
|
||||
set_target_properties(Tutorial PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
|
||||
|
||||
target_link_libraries(Tutorial PUBLIC MathFunctions tutorial_compiler_flags)
|
||||
|
||||
# add the binary tree to the search path for include files
|
||||
# so that we will find TutorialConfig.h
|
||||
target_include_directories(Tutorial PUBLIC
|
||||
"${PROJECT_BINARY_DIR}"
|
||||
)
|
||||
|
||||
# add the install targets
|
||||
install(TARGETS Tutorial DESTINATION bin)
|
||||
install(FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h"
|
||||
DESTINATION include
|
||||
)
|
||||
|
||||
# enable testing
|
||||
enable_testing()
|
||||
|
||||
# does the application run
|
||||
add_test(NAME Runs COMMAND Tutorial 25)
|
||||
|
||||
# does the usage message work?
|
||||
add_test(NAME Usage COMMAND Tutorial)
|
||||
set_tests_properties(Usage
|
||||
PROPERTIES PASS_REGULAR_EXPRESSION "Usage:.*number"
|
||||
)
|
||||
|
||||
# define a function to simplify adding tests
|
||||
function(do_test target arg result)
|
||||
add_test(NAME Comp${arg} COMMAND ${target} ${arg})
|
||||
set_tests_properties(Comp${arg}
|
||||
PROPERTIES PASS_REGULAR_EXPRESSION ${result}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
# do a bunch of result based tests
|
||||
do_test(Tutorial 4 "4 is 2")
|
||||
do_test(Tutorial 9 "9 is 3")
|
||||
do_test(Tutorial 5 "5 is 2.236")
|
||||
do_test(Tutorial 7 "7 is 2.645")
|
||||
do_test(Tutorial 25 "25 is 5")
|
||||
do_test(Tutorial -25 "-25 is (-nan|nan|0)")
|
||||
do_test(Tutorial 0.0001 "0.0001 is 0.01")
|
||||
|
||||
# setup installer
|
||||
include(InstallRequiredSystemLibraries)
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${Tutorial_VERSION_MAJOR}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${Tutorial_VERSION_MINOR}")
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
include(CPack)
|
||||
|
||||
# install the configuration targets
|
||||
install(EXPORT MathFunctionsTargets
|
||||
FILE MathFunctionsTargets.cmake
|
||||
DESTINATION lib/cmake/MathFunctions
|
||||
)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
# generate the config file that is includes the exports
|
||||
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake"
|
||||
INSTALL_DESTINATION "lib/cmake/example"
|
||||
NO_SET_AND_CHECK_MACRO
|
||||
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||
)
|
||||
# generate the version file for the config file
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfigVersion.cmake"
|
||||
VERSION "${Tutorial_VERSION_MAJOR}.${Tutorial_VERSION_MINOR}"
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
|
||||
# install the configuration file
|
||||
install(FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsConfig.cmake
|
||||
DESTINATION lib/cmake/MathFunctions
|
||||
)
|
||||
|
||||
# generate the export targets for the build tree
|
||||
# needs to be after the install(TARGETS ) command
|
||||
export(EXPORT MathFunctionsTargets
|
||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/MathFunctionsTargets.cmake"
|
||||
)
|
||||
@@ -0,0 +1,3 @@
|
||||
; configuration for php mysql module
|
||||
; priority=10
|
||||
extension=mysqlnd.so
|
||||
@@ -0,0 +1,69 @@
|
||||
%title: a crash course on handling deb packages
|
||||
%author: jesse portnoy <jesse@packman.io>
|
||||
%date: 2023-07-11
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
## topics covered in this course
|
||||
|
||||
- what is a `deb` package?
|
||||
- what is dpkg?
|
||||
- what is apt?
|
||||
- the `apt` util
|
||||
- `apt-get`
|
||||
- `apt-cache`
|
||||
- `apt-file`
|
||||
- fetching and installing packages
|
||||
- install vs. upgrade
|
||||
- non-interactive operations
|
||||
- a note on dependencies
|
||||
- package dependencies & relationships
|
||||
- querying the local packages db
|
||||
- querying remote repos
|
||||
- configuration operations
|
||||
- downloading & building packages from source
|
||||
- automating the installation of packages that require inputs
|
||||
- removing packages
|
||||
- thanks & final note
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
```php
|
||||
<?php
|
||||
phpinfo();
|
||||
echo "Hello World\n";
|
||||
var 7 = 1;
|
||||
?>
|
||||
```
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
## What is a `deb` package?
|
||||
|
||||
*deb* is the format, as well as filename extension of the software package format for the Debian Linux distribution
|
||||
and its derivatives. Debian packages are standard UNIX *ar* archives that include two tar archives.
|
||||
One archive holds the control information and another contains the installable data.
|
||||
|
||||
## What is dpkg?
|
||||
|
||||
*dpkg* is a tool to install, build, remove and manage Debian packages.
|
||||
|
||||
*dpkg* is controlled entirely via command line parameters, which consist of exactly one action and zero or more options.
|
||||
The action parameter tells *dpkg* what to do and options control the behavior of the action in some way.
|
||||
|
||||
*dpkg* maintains some usable information about available packages. The information is divided in three classes: states,
|
||||
selection states and flags.
|
||||
|
||||
## What is APT?
|
||||
|
||||
Advanced Package Tool, or APT, is a free-software user interface that works with core libraries to handle the installation
|
||||
and removal of software on Debian, and Debian-based Linux distributions. APT simplifies the process of managing software by
|
||||
automating the retrieval, configuration and installation of software packages.
|
||||
|
||||
In the next slide, we'll review some important APT utils and their respective functionality.
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
if ($something){
|
||||
phpinfo();
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
prompt ()
|
||||
{
|
||||
FCM=$(fc -ln -0)
|
||||
CM=$(echo "$FCM"|awk -F " " '{print $1}')
|
||||
if ls /etc/supercat/spcrc-"$CM"* > /dev/null 2>&1; then
|
||||
echo "Rerun with colour [y/n]?"
|
||||
read -r YN
|
||||
if [ "$YN" = 'y' ] || [ "$YN" = 'Y' ] ;then
|
||||
eval "$FCM"| spc -c /etc/supercat/spcrc-"$CM"*
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
export PROMPT_COMMAND=prompt
|
||||
@@ -0,0 +1,12 @@
|
||||
filetype: diff
|
||||
|
||||
detect:
|
||||
filename: "\\.diff$"
|
||||
header: "^((---.*)|(\\+\\+\\+.*))"
|
||||
|
||||
rules:
|
||||
- statement: "(^\\+\\+\\+.*)"
|
||||
- statement: "(^---.*)"
|
||||
- type: "(^@@.*)"
|
||||
- constant.number: "(^\\+.*)"
|
||||
- preproc: "(^-.*)"
|
||||
Reference in New Issue
Block a user