Skip to content

Instantly share code, notes, and snippets.

val ktor_version: String by project
val kotlin_version: String by project
val logback_version: String by project
plugins {
application
kotlin("jvm") version "1.7.20"
id("io.ktor.plugin") version "2.1.2"
}
<cfscript>
s = "12345678901234567890"
writeDump([
"s" = s,
"val(s)" = val(s),
"s.getClass().getName()" = s.getClass().getName(),
"val(s).getClass().getName()" = val(s).getClass().getName()
])
d = 12345678901234567890
@adamcameron
adamcameron / code.cfm
Created August 28, 2022 10:57
Code review for Ookma
function index( event, rc, prc ){
prc.pageTitle = "Reset Password";
if( isEmpty( rc?.user ) || isEmpty( rc?.token ) ) {
return event.setView( "resetpassword/malformedurl" );
}
var rows = getInstance( "User" ).firstWhere( "id", rc.user );
if( isNull( rows ) ) {
return event.setView( "resetpassword/malformedurl" );
@adamcameron
adamcameron / testHarness.cfm
Created May 18, 2022 19:33
Harness to pull in all the test Gists from github and then run them on trycf.com
<cfscript>
cfhttp(
method = "get",
url = "https://gist.githubusercontent.com/adamcameron/816ce84fd991c2682df612dbaf1cad11/raw/tinyTestFramework.cfm",
result = "frameworkCodeResponse",
throwOnError = true
);
frameworkCode = frameworkCodeResponse.fileContent;
@adamcameron
adamcameron / ttfLifeCycleFunctionsTest.cfm
Created May 18, 2022 18:57
TTF tests for lifecycle functions
<cfscript>
void function run() {
beforeAll(() => {
tinyTest.debug.setByBeforeAll = true
})
describe("Tests of beforeEach", () => {
describe("Tests without beforeEach (top)", () => {
result = []
it("was called before any usage of beforeEach", () => {
@adamcameron
adamcameron / ttfMatcherFunctionsTest.cfm
Last active May 18, 2022 18:59
TTF tests for matcher functions
<cfscript>
void function run() {
describe("Tests of toBe", () => {
it("passes if the actual and expected values are equal", () => {
var actual = "TEST_VALUE"
var expected = "TEST_VALUE"
result = expect(actual).toBe(expected)
if (isNull(result) || !result) {
throw(type="TinyTest.TestFailedException")
@adamcameron
adamcameron / ttfOtherFunctionsTest.cfm
Last active May 19, 2022 11:48
TTF tests for misc functions that don't fit another category
<cfscript>
void function run() {
describe("Tests of it", () => {
it("prefixes its message with ""It""", () => {
savecontent variable="message" {
it("IS A TEST MESSAGE", () => {})
}
tinyTest.results.pass--
expect(message).toInclude("It IS A TEST MESSAGE")
})
@adamcameron
adamcameron / AbstractBase.cfc
Created May 16, 2022 17:37
Jim Partin repro. Maybe. Dunno.
abstract component {
function init() {
writeOutput("AbstractBase init called<br>")
}
}
@adamcameron
adamcameron / afterAllBasicTest.cfm
Created May 14, 2022 20:48
First test for afterAll functionality of TinyTestFramework
<cfscript>
function run() {
afterAll(() => {
writeOutput("afterAll ran OK")
})
describe("Tests of afterAll", () => {
it("is a simple test", () => {
expect(true).toBeTrue()
})
@adamcameron
adamcameron / passingTestForTinyTestFramework.cfm
Created May 14, 2022 20:17
A test to load into the saved gist that has the framework loaded as setupcode in trycf.com
<cfscript>
function run() {
describe("some tests", () => {
it("a passing test", () => {
expect(true).toBe(true)
})
})
}
tinyTest.runTests()